diff options
author | Tom Gundersen <teg@jklm.no> | 2015-07-14 04:32:29 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-07-14 19:36:35 +0200 |
commit | d23a27a964748967e1ad20e86de869a753af555b (patch) | |
tree | db74f180a3b052cab81aea4d20a8b576f3221f9b /src/resolve | |
parent | abf126a355e2f2b62b6c51ab3bb37895d1e3eee7 (diff) |
resolved: improve printing of unknown RRs
This implements the recommendations from RFC3597.
Diffstat (limited to 'src/resolve')
-rw-r--r-- | src/resolve/resolved-dns-rr.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c index dd3e44f6de..676b77713e 100644 --- a/src/resolve/resolved-dns-rr.c +++ b/src/resolve/resolved-dns-rr.c @@ -171,19 +171,19 @@ const struct hash_ops dns_resource_key_hash_ops = { }; int dns_resource_key_to_string(const DnsResourceKey *key, char **ret) { - char cbuf[DECIMAL_STR_MAX(uint16_t)], tbuf[DECIMAL_STR_MAX(uint16_t)]; + char cbuf[strlen("CLASS") + DECIMAL_STR_MAX(uint16_t)], tbuf[strlen("TYPE") + DECIMAL_STR_MAX(uint16_t)]; const char *c, *t; char *s; c = dns_class_to_string(key->class); if (!c) { - sprintf(cbuf, "%i", key->class); + sprintf(cbuf, "CLASS%u", key->class); c = cbuf; } t = dns_type_to_string(key->type); if (!t){ - sprintf(tbuf, "%i", key->type); + sprintf(tbuf, "TYPE%u", key->type); t = tbuf; } @@ -709,8 +709,8 @@ int dns_resource_record_to_string(const DnsResourceRecord *rr, char **ret) { if (!t) return -ENOMEM; - s = strjoin(k, " ", t, NULL); - if (!s) + r = asprintf(&s, "%s \\# %"PRIu8" %s", k, rr->generic.size, t); + if (r < 0) return -ENOMEM; break; } |