bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf produces no output for %f directive


From: Jim Meyering
Subject: Re: printf produces no output for %f directive
Date: Fri, 19 Oct 2007 15:27:42 +0200

Eric Blake <address@hidden> wrote:

> 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?

Yep.  That's what I'm doing :)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]