diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-12-04 17:49:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-04 17:49:05 +0100 |
commit | fea909c1b968f03b7f78b83f256d01ccc155bdba (patch) | |
tree | d186abb30af476e5c0c9a40f7f3b19fa8cb02a58 /src/shared | |
parent | 32c7f02bb49bb348ff2256dbfd35a5f0136915ff (diff) | |
parent | dcbe4a6860c2320592b8457a7da4bb00331c86e8 (diff) | |
download | systemd-fea909c1b968f03b7f78b83f256d01ccc155bdba.tar.gz |
Merge pull request #17854 from poettering/dns-domain-ret-fix
dns-domain: fix some coding style issues
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/dns-domain.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c index b02ad3f521..cc5ad582db 100644 --- a/src/shared/dns-domain.c +++ b/src/shared/dns-domain.c @@ -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; } @@ -1308,18 +1311,19 @@ int dns_name_apply_idna(const char *name, char **ret) { if (r != IDN2_OK) { log_debug("idn2_to_unicode_8z8z(\"%s\") failed: %d/%s", t, r, sym_idn2_strerror(r)); + *ret = NULL; return 0; } if (!streq_ptr(name, s)) { log_debug("idn2 roundtrip failed: \"%s\" → \"%s\" → \"%s\", ignoring.", name, t, s); + *ret = NULL; return 0; } } *ret = TAKE_PTR(t); - return 1; /* *ret has been written */ } @@ -1329,6 +1333,7 @@ int dns_name_apply_idna(const char *name, char **ret) { return 0; if (IN_SET(r, IDN2_TOO_BIG_DOMAIN, IDN2_TOO_BIG_LABEL)) return -ENOSPC; + return -EINVAL; #elif HAVE_LIBIDN _cleanup_free_ char *buf = NULL; |