]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
resolv: Improve formatting of unknown records in ns_sprintrrf
authorFlorian Weimer <fweimer@redhat.com>
Fri, 19 Jun 2026 16:22:20 +0000 (18:22 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 19 Jun 2026 16:22:20 +0000 (18:22 +0200)
Do not add the "unknown RR type" comment.  After adding the TYPE
prefix, the number is largely redundant.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
resolv/ns_print.c

index e75c39eaa8a89e0a2b5d30c52bdf9aa85de23ea5..3d38876483ac1a31fe8c196e6fffefea1b5fdf8e 100644 (file)
@@ -115,7 +115,6 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
 
        const char *comment;
        char tmp[100];
-       char errbuf[40];
        int len, x;
 
        /*
@@ -590,20 +589,18 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
                T(addstr(tmp, len, &buf, &buflen));
                break;
            }
-
        default:
-               snprintf (errbuf, sizeof (errbuf), "unknown RR type %d", type);
-               comment = errbuf;
+               comment = "";
                goto hexify;
        }
        return (buf - obuf);
  formerr:
-       comment = "RR format error";
+       comment = " ; RR format error";
  hexify: {
        int n, m;
        char *p;
 
-       len = SPRINTF((tmp, "\\# %u%s\t; %s", (unsigned)(edata - rdata),
+       len = SPRINTF((tmp, "\\# %u%s%s", (unsigned)(edata - rdata),
                       rdlen != 0U ? " (" : "", comment));
        T(addstr(tmp, len, &buf, &buflen));
        while (rdata < edata) {