1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00

Merge pull request #17854 from poettering/dns-domain-ret-fix

dns-domain: fix some coding style issues
This commit is contained in:
Lennart Poettering 2020-12-04 17:49:05 +01:00 committed by GitHub
commit fea909c1b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -743,12 +743,12 @@ int dns_name_reverse(int family, const union in_addr_union *a, char **ret) {
return 0; 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; int r;
assert(p); assert(p);
assert(family); assert(ret_family);
assert(address); assert(ret_address);
r = dns_name_endswith(p, "in-addr.arpa"); r = dns_name_endswith(p, "in-addr.arpa");
if (r < 0) if (r < 0)
@ -777,11 +777,11 @@ int dns_name_address(const char *p, int *family, union in_addr_union *address) {
if (r <= 0) if (r <= 0)
return r; return r;
*family = AF_INET; *ret_family = AF_INET;
address->in.s_addr = htobe32(((uint32_t) a[3] << 24) | ret_address->in.s_addr = htobe32(((uint32_t) a[3] << 24) |
((uint32_t) a[2] << 16) | ((uint32_t) a[2] << 16) |
((uint32_t) a[1] << 8) | ((uint32_t) a[1] << 8) |
(uint32_t) a[0]); (uint32_t) a[0]);
return 1; return 1;
} }
@ -822,11 +822,14 @@ int dns_name_address(const char *p, int *family, union in_addr_union *address) {
if (r <= 0) if (r <= 0)
return r; return r;
*family = AF_INET6; *ret_family = AF_INET6;
address->in6 = a; ret_address->in6 = a;
return 1; return 1;
} }
*ret_family = AF_UNSPEC;
*ret_address = IN_ADDR_NULL;
return 0; return 0;
} }
@ -1308,18 +1311,19 @@ int dns_name_apply_idna(const char *name, char **ret) {
if (r != IDN2_OK) { if (r != IDN2_OK) {
log_debug("idn2_to_unicode_8z8z(\"%s\") failed: %d/%s", log_debug("idn2_to_unicode_8z8z(\"%s\") failed: %d/%s",
t, r, sym_idn2_strerror(r)); t, r, sym_idn2_strerror(r));
*ret = NULL;
return 0; return 0;
} }
if (!streq_ptr(name, s)) { if (!streq_ptr(name, s)) {
log_debug("idn2 roundtrip failed: \"%s\"\"%s\"\"%s\", ignoring.", log_debug("idn2 roundtrip failed: \"%s\"\"%s\"\"%s\", ignoring.",
name, t, s); name, t, s);
*ret = NULL;
return 0; return 0;
} }
} }
*ret = TAKE_PTR(t); *ret = TAKE_PTR(t);
return 1; /* *ret has been written */ return 1; /* *ret has been written */
} }
@ -1329,6 +1333,7 @@ int dns_name_apply_idna(const char *name, char **ret) {
return 0; return 0;
if (IN_SET(r, IDN2_TOO_BIG_DOMAIN, IDN2_TOO_BIG_LABEL)) if (IN_SET(r, IDN2_TOO_BIG_DOMAIN, IDN2_TOO_BIG_LABEL))
return -ENOSPC; return -ENOSPC;
return -EINVAL; return -EINVAL;
#elif HAVE_LIBIDN #elif HAVE_LIBIDN
_cleanup_free_ char *buf = NULL; _cleanup_free_ char *buf = NULL;