[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#11631: closed (Re: bug#11631: Head command does not position file po
From: |
Jim Meyering |
Subject: |
bug#11631: closed (Re: bug#11631: Head command does not position file pointer correctly for negative line count) |
Date: |
Wed, 06 Jun 2012 15:01:25 +0200 |
Jim Meyering wrote:
> Anoop Sharma wrote:
>> 1. The comment in code - "Don't bother testing for failure for such a
>> small amount. Any failure will be detected upon close." may be
>> re-looked too, since we are now lseeking after it.
>>
>> What if we change plain fwrite to:
>> if (fwrite (buffer, 1, n + 1, stdout) < (n + 1))
>> error (EXIT_FAILURE, errno, _("write error"));
...
> Regarding #1, thanks for the suggestion. You're right.
Actually, the existing code is fine.
I'm glad I didn't push that change in your name.
It's not that it would introduce a bug or anything,
but the rationale was incorrect:
The fwrite affects only the output stream, stdout,
while the lseek operates on the input file descriptor,
so they are independent, and the comment is still valid.
The only possible overlap is errno, but if lseek fails,
we now exit immediately, so whether close_stdout has
an errno or not is irrelevant.
- bug#11631: Head command does not position file pointer correctly for negative line count, (continued)
- Message not available
- bug#11631: closed (Re: bug#11631: Head command does not position file pointer correctly for negative line count), Anoop Sharma, 2012/06/06
- bug#11631: closed (Re: bug#11631: Head command does not position file pointer correctly for negative line count), Jim Meyering, 2012/06/06
- bug#11631: closed (Re: bug#11631: Head command does not position file pointer correctly for negative line count), Eric Blake, 2012/06/06
- bug#11631: closed (Re: bug#11631: Head command does not position file pointer correctly for negative line count), Jim Meyering, 2012/06/06
- bug#11631: closed (Re: bug#11631: Head command does not position file pointer correctly for negative line count), Anoop Sharma, 2012/06/07
- bug#11631: closed (Re: bug#11631: Head command does not position file pointer correctly for negative line count), Jim Meyering, 2012/06/07
- bug#11631: closed (Re: bug#11631: Head command does not position file pointer correctly for negative line count), Anoop Sharma, 2012/06/08
- bug#11631: closed (Re: bug#11631: Head command does not position file pointer correctly for negative line count), Eric Blake, 2012/06/07
- bug#11631: closed (Re: bug#11631: Head command does not position file pointer correctly for negative line count), Anoop Sharma, 2012/06/08
- bug#11631: closed (Re: bug#11631: Head command does not position file pointer correctly for negative line count),
Jim Meyering <=