From: A. Wilcox Date: Sat, 6 Sep 2025 08:12:07 +0000 (-0500) Subject: xfs_scrub: Use POSIX-conformant strerror_r X-Git-Tag: v6.17.0~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=75faf2bc907584;p=thirdparty%2Fxfsprogs-dev.git xfs_scrub: Use POSIX-conformant strerror_r When building xfsprogs with musl libc, strerror_r returns int as specified in POSIX. This differs from the glibc extension that returns char*. Successful calls will return 0, which will be dereferenced as a NULL pointer by (v)fprintf. Signed-off-by: A. Wilcox Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong --- diff --git a/scrub/common.c b/scrub/common.c index 14cd677b..9437d0ab 100644 --- a/scrub/common.c +++ b/scrub/common.c @@ -126,7 +126,8 @@ __str_out( fprintf(stream, "%s%s: %s: ", stream_start(stream), _(err_levels[level].string), descr); if (error) { - fprintf(stream, _("%s."), strerror_r(error, buf, DESCR_BUFSZ)); + strerror_r(error, buf, DESCR_BUFSZ); + fprintf(stream, _("%s."), buf); } else { va_start(args, format); vfprintf(stream, format, args);