From: "Darrick J. Wong" <djwong@kernel.org>
To: "A. Wilcox" <AWilcox@wilcox-tech.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v2] xfs_scrub: Use POSIX-conformant strerror_r
Date: Fri, 12 Sep 2025 08:00:44 -0700 [thread overview]
Message-ID: <20250912150044.GN8096@frogsfrogsfrogs> (raw)
In-Reply-To: <20250906081222.64798-1-AWilcox@Wilcox-Tech.com>
On Sat, Sep 06, 2025 at 03:12:07AM -0500, A. Wilcox wrote:
> 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>
Isn't C fun?
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> 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 prev parent reply other threads:[~2025-09-12 15:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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=20250912150044.GN8096@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox