1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
From da3ad6ffc9ecf75ebb734bbb863c1412d11b9beb Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Sat, 10 Aug 2024 21:26:57 -0500
Subject: [PATCH] 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 <AWilcox@Wilcox-Tech.com>
---
scrub/common.c | 3 ++-
scrub/inodes.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/scrub/common.c b/scrub/common.c
index 283ac84e..bd8bde35 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);
|