From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
To: linux-xfs@vger.kernel.org
Cc: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Subject: [PATCH v2] xfs_scrub: Use POSIX-conformant strerror_r
Date: Sat, 6 Sep 2025 03:12:07 -0500 [thread overview]
Message-ID: <20250906081222.64798-1-AWilcox@Wilcox-Tech.com> (raw)
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 <AWilcox@Wilcox-Tech.com>
---
scrub/common.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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);
--
2.49.0
next reply other threads:[~2025-09-06 8:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-06 8:12 A. Wilcox [this message]
2025-09-12 7:14 ` [PATCH v2] xfs_scrub: Use POSIX-conformant strerror_r Christoph Hellwig
2025-09-12 15:00 ` Darrick J. Wong
2025-09-18 16:27 ` Darrick J. Wong
2025-09-19 10:52 ` Andrey Albershteyn
2025-09-19 16:25 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250906081222.64798-1-AWilcox@Wilcox-Tech.com \
--to=awilcox@wilcox-tech.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.