The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=72c848089f3b03ee31208ca18f652a16d8fb8352

commit 72c848089f3b03ee31208ca18f652a16d8fb8352
Author:     Konstantin Belousov <k...@freebsd.org>
AuthorDate: 2025-07-08 14:01:32 +0000
Commit:     Konstantin Belousov <k...@freebsd.org>
CommitDate: 2025-07-08 15:55:54 +0000

    libc: only append exterr herald and text if exterr was recorded
    
    __uexterr_format: return empty string on no error, instead of "No error"
    err(): check for the first symbol of the exterr to decide if there is
    anything to print.
    
    Requested and reviewed by:      markj
    Sponsored by:   The FreeBSD Foundation
    Differential revision:  https://reviews.freebsd.org/D51204
---
 lib/libc/gen/err.c            | 2 +-
 lib/libc/gen/uexterr_format.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/libc/gen/err.c b/lib/libc/gen/err.c
index cdce20af5a91..16cbe27693e7 100644
--- a/lib/libc/gen/err.c
+++ b/lib/libc/gen/err.c
@@ -119,7 +119,7 @@ vexterr(bool doexterr, int code, const char *fmt, va_list 
ap)
                fprintf(err_file, ": ");
        }
        fprintf(err_file, "%s", strerror(code));
-       if (doexterr && extstatus == 0)
+       if (doexterr && extstatus == 0 && exterr[0] != '\0')
                fprintf(err_file, " (extended error %s)", exterr);
        fprintf(err_file, "\n");
 }
diff --git a/lib/libc/gen/uexterr_format.c b/lib/libc/gen/uexterr_format.c
index 86ba40234ae4..e8ddfbd578e3 100644
--- a/lib/libc/gen/uexterr_format.c
+++ b/lib/libc/gen/uexterr_format.c
@@ -20,7 +20,7 @@ __uexterr_format(const struct uexterror *ue, char *buf, 
size_t bufsz)
        if (bufsz > UEXTERROR_MAXLEN)
                bufsz = UEXTERROR_MAXLEN;
        if (ue->error == 0) {
-               strlcpy(buf, "No error", bufsz);
+               strlcpy(buf, "", bufsz);
                return (0);
        }
        if (ue->msg[0] == '\0') {

Reply via email to