From: Lennart Poettering Date: Sat, 2 Jan 2016 20:34:17 +0000 (+0100) Subject: resolved: only suffix RR key names with a dot if they don't have one yet X-Git-Tag: v231~820^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f2af5ea3cbf54998ed41d2d21a3448abb92ca7ff;p=platform%2Fupstream%2Fsystemd.git resolved: only suffix RR key names with a dot if they don't have one yet --- diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c index 274e857..4d47f48 100644 --- a/src/resolve/resolved-dns-rr.c +++ b/src/resolve/resolved-dns-rr.c @@ -308,7 +308,7 @@ const struct hash_ops dns_resource_key_hash_ops = { int dns_resource_key_to_string(const DnsResourceKey *key, char **ret) { char cbuf[strlen("CLASS") + DECIMAL_STR_MAX(uint16_t)], tbuf[strlen("TYPE") + DECIMAL_STR_MAX(uint16_t)]; - const char *c, *t; + const char *c, *t, *n; char *s; /* If we cannot convert the CLASS/TYPE into a known string, @@ -326,7 +326,8 @@ int dns_resource_key_to_string(const DnsResourceKey *key, char **ret) { t = tbuf; } - if (asprintf(&s, "%s. %s %-5s", DNS_RESOURCE_KEY_NAME(key), c, t) < 0) + n = DNS_RESOURCE_KEY_NAME(key); + if (asprintf(&s, "%s%s %s %-5s", n, endswith(n, ".") ? "" : ".", c, t) < 0) return -ENOMEM; *ret = s;