mirror of
https://github.com/systemd/systemd.git
synced 2025-01-26 14:04:03 +03:00
dns-domain: initialize return param on success
This commit is contained in:
parent
cb3714d100
commit
dcbe4a6860
@ -743,12 +743,12 @@ int dns_name_reverse(int family, const union in_addr_union *a, char **ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dns_name_address(const char *p, int *family, union in_addr_union *address) {
|
||||
int dns_name_address(const char *p, int *ret_family, union in_addr_union *ret_address) {
|
||||
int r;
|
||||
|
||||
assert(p);
|
||||
assert(family);
|
||||
assert(address);
|
||||
assert(ret_family);
|
||||
assert(ret_address);
|
||||
|
||||
r = dns_name_endswith(p, "in-addr.arpa");
|
||||
if (r < 0)
|
||||
@ -777,11 +777,11 @@ int dns_name_address(const char *p, int *family, union in_addr_union *address) {
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
*family = AF_INET;
|
||||
address->in.s_addr = htobe32(((uint32_t) a[3] << 24) |
|
||||
((uint32_t) a[2] << 16) |
|
||||
((uint32_t) a[1] << 8) |
|
||||
(uint32_t) a[0]);
|
||||
*ret_family = AF_INET;
|
||||
ret_address->in.s_addr = htobe32(((uint32_t) a[3] << 24) |
|
||||
((uint32_t) a[2] << 16) |
|
||||
((uint32_t) a[1] << 8) |
|
||||
(uint32_t) a[0]);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -822,11 +822,14 @@ int dns_name_address(const char *p, int *family, union in_addr_union *address) {
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
*family = AF_INET6;
|
||||
address->in6 = a;
|
||||
*ret_family = AF_INET6;
|
||||
ret_address->in6 = a;
|
||||
return 1;
|
||||
}
|
||||
|
||||
*ret_family = AF_UNSPEC;
|
||||
*ret_address = IN_ADDR_NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user