[uClibc]fseek(3) idempotency
Matt Kraai
kraai at alumni.carnegiemellon.edu
Tue Sep 25 15:10:49 UTC 2001
On Tue, Sep 25, 2001 at 08:35:37AM -0600, Manuel Novoa III wrote:
> A couple of notes:
>
> 1) I agree that there is no need in this case to invalidate the
> readahead buffer. Regarding Matt's patch though, the
> "if (READING(fp))" test is unnecessary. The assignment works
> for both reading or writing (although redundant here).
OK, then I'll commit the appropriately modified patch. I'm an
infrequent uClibc hacker, so I plead ignorance.
> 2) Even with this change, seek_sub_file() is still broken as fseek()
> will set the error flag for the FILE if it corresponds to a pipe
> or fifo, and subsequent reads should fail. A clearerr() call
> needs to be done too.
Then fseek() isn't SUSv2 compliant:
... otherwise they return -1 and set errno to indicate the
error.
Contrast this with the description for fread():
Otherwise, if a read error occurs, the error indicator for
the stream is set and errno is set to indicate the error.
OK to also commit a patch which prevents fseek() from setting the
error indicator?
Matt
More information about the uClibc
mailing list