On 01/20/2012 07:40 AM, Paolo Bonzini wrote:
>> @@ -881,7 +882,7 @@ prline (char const *beg, char const *lim, int sep)
>> fwrite (beg, 1, lim - beg, stdout);
>>
>> if (ferror (stdout))
>> - error (0, errno, _("writing output"));
>> + error ((errno == EPIPE) ? EXIT_FAILURE : 0, errno, _("writing
>> output"));
>>
>> lastout = lim;
>>
>
> I think this should be EXIT_TROUBLE (aka exit status 2). Jim/Paul, what
> do you think?Alas, ferror() does not guarantee that errno is in a reliable state compared to when the first write error was detected. To properly check for EPIPE, you'd have to check errno after every fputc(), fwrite(), fprintf(), and so forth. -- Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
