Skip to content

Commit

Permalink
resolved: improve printing of unknown RRs
Browse files Browse the repository at this point in the history
This implements the recommendations from RFC3597.
  • Loading branch information
teg committed Jul 14, 2015
1 parent abf126a commit d23a27a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/resolve/resolved-dns-rr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit d23a27a

Please sign in to comment.