This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] ftell: seek to end only when there are unflushed bytes (BZ #17647)


On Wed, Nov 26, 2014 at 02:26:01PM +0530, Siddhesh Poyarekar wrote:
> On Tue, Nov 25, 2014 at 03:14:15PM -0500, Rich Felker wrote:
> > I haven't read these patches in detail, but are you sure this matters?
> > I think the "active handle" rules forbid truncating a file while a
> > stdio stream is the active handle, but I may be mistaken.
> 
> Apparently, they don't.  The active handle rules seem to only forbid
> operations that modify the file offset and ftruncate does not modify
> the file offset.  Instead, ftell ends up modifying the file offset by
> explicitly seeking to the end of file when it is not immediately
> required, thus breaking expectations of what the offset returned
> should be.

OK. FWIW, your new condition, unflushed_writes && append_mode, matches
what I've had in musl and I believe it's the correct condition.

Rich


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]