[uClibc]fseek(3) idempotency
Matt Kraai
kraai at alumni.carnegiemellon.edu
Mon Sep 24 16:35:03 UTC 2001
On Mon, Sep 24, 2001 at 10:03:03AM -0600, Manuel Novoa III wrote:
> Matt,
>
> On Mon, Sep 24, 2001 at 09:25:31AM -0600, Matt Kraai wrote:
> > The uClibc fseek(3) implementation clears the readahead buffer
> > before calling lseek(2). If lseek(2) fails (e.g., it is called on
> > a pipe), the position is now off.
>
> In my interpretation of the standards, if fseek() fails the error
> indicator for the stream is set and the associated file offset is
> undefined. What's the problem?
>
> > The following patch only resets
> > the readahead buffer if the lseek(2) call succeeds.
>
> It looks to me like you're trying to deal with an application bug
> by introducing implementation-defined behavior to uClibc.
According to SUSv2,
The behaviour of fseek() on devices which are incapable of
seeking is implementation-dependent.
How can you determine if a device supports seeking?
Matt
More information about the uClibc
mailing list