diff options
| author | Bruno Haible <bruno@clisp.org> | 2025-09-18 23:05:06 +0200 |
|---|---|---|
| committer | Pádraig Brady <P@draigBrady.com> | 2025-09-18 22:33:51 +0100 |
| commit | 71a8cdf6b1f04e95aa74a2f304d68530638d229a (patch) | |
| tree | 2bb6798e91b22ba2b9ed87e8af1533bfdc8ad40b | |
| parent | maint: we use Gnulib’s stddef-h module directly (diff) | |
| download | coreutils-71a8cdf6b1f04e95aa74a2f304d68530638d229a.tar.gz coreutils-71a8cdf6b1f04e95aa74a2f304d68530638d229a.zip | |
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.
| -rw-r--r-- | src/fmt.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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; } |
