Linux XFS filesystem development
 help / color / mirror / Atom feed
* [PATCH v2] xfs_scrub: Use POSIX-conformant strerror_r
@ 2025-09-06  8:12 A. Wilcox
  2025-09-12  7:14 ` Christoph Hellwig
  2025-09-12 15:00 ` Darrick J. Wong
  0 siblings, 2 replies; 6+ messages in thread
From: A. Wilcox @ 2025-09-06  8:12 UTC (permalink / raw)
  To: linux-xfs; +Cc: A. Wilcox

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-09-19 16:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-06  8:12 [PATCH v2] xfs_scrub: Use POSIX-conformant strerror_r A. Wilcox
2025-09-12  7:14 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox