From: Bruno Haible Date: Thu, 18 Sep 2025 21:05:06 +0000 (+0200) Subject: fmt: eliminate a clang -Wformat-extra-args warning X-Git-Tag: v9.8~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=71a8cdf6b1f04e95aa74a2f304d68530638d229a;p=thirdparty%2Fcoreutils.git fmt: eliminate a clang -Wformat-extra-args warning * src/fmt.c (fmt): When not reading from stdin, always mention the file name in the error message. --- diff --git a/src/fmt.c b/src/fmt.c index b44bbde5c7..244a8a5c92 100644 --- a/src/fmt.c +++ b/src/fmt.c @@ -493,12 +493,18 @@ fmt (FILE *f, char const *file) } int err = ferror (f) ? 0 : -1; + /* err < 0 means success. */ if (f == stdin) clearerr (f); else if (fclose (f) != 0 && err < 0) err = errno; if (0 <= err) - error (0, err, err ? "%s" : _("read error"), quotef (file)); + { + if (f == stdin) + error (0, err, _("read error")); + else + error (0, err, _("error reading %s"), quoteaf (file)); + } return err < 0; }