[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: printf produces no output for %f directive
From: |
Eric Blake |
Subject: |
Re: printf produces no output for %f directive |
Date: |
Fri, 19 Oct 2007 07:20:28 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Andreas Schwab on 10/19/2007 6:58 AM:
> Jim Meyering <address@hidden> writes:
>
>> Could it be a bug in printf for failing, yet not setting the
>> stream-failure indicator that is checked by close_stdout's ferror?
>
> A failure from printf does not necessarily mean an output failure. It
> can also be ENOMEM or EILSEQ, which are unrelated to output.
Wow. You're right. Which means the return value of printf/fprintf must
always be checked in a secure program. It looks like m4 has some bugs in
this area (admittedly corner case, since it is not on user-provided
strings with large padding values, so the likelihood of running out of
memory exactly during the printf is smaller)...
Would it be worth a xprintf and xfprintf gnulib wrapper that exits the
program immediately on non-output errors from the wrapped printf/fprintf?
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHGK8c84KuGfSFAYARAvJFAKC0hVnovKl3pf33BBWqle4M1hxw0QCfYmFq
e70Lu8UzXwKYZx7S5LOZMF8=
=0lbq
-----END PGP SIGNATURE-----
- printf produces no output for %f directive, Bruno Haible, 2007/10/19
- Re: printf produces no output for %f directive, Jim Meyering, 2007/10/19
- Re: POSIX requires checking all *printf return values?!?, Andreas Schwab, 2007/10/19
- Re: POSIX requires checking all *printf return values?!?, Eric Blake, 2007/10/19
- Re: POSIX requires checking all *printf return values?!?, Jim Meyering, 2007/10/19
- Re: POSIX requires checking all *printf return values?!?, Eric Blake, 2007/10/19
- Re: POSIX requires checking all *printf return values?!?, Nick Stoughton, 2007/10/19