On 18/09/2025 22:08, Bruno Haible wrote:
On FreeBSD 11, I see this warning:

../src/fmt.c:501:50: warning: data argument not used by format string 
[-Wformat-extra-args]

The code there implements this logic:
   - If an error number is known, present an error message with a file name,
     but without telling the user in which context the error occurred.
   - If an error number is not known, tell the user about the context,
     but not about the file name.

This logic makes no sense.

Here's a patch to change that. Its effects are:

When a file name is known, e.g. "foobar.txt":

   If there was an error before fclose():
     Before:  read error
     After:   error reading 'foobar.txt'

   If there was no error before fclose():
     Before:  'foobar.txt': I/O error
     After:   error reading 'foobar.txt': I/O error

When reading from standard input (in this case no error number is known):

   Before:  read error
   After:   read error
Applied.

thanks,
Padraig

Reply via email to