[PATCH v2] xfs_scrub: Use POSIX-conformant strerror_r

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux