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] Fix ftell with fdopen for all cases and fopen with a+ mode (#16532)


On Wed, Feb 19, 2014 at 12:51:13PM +0530, Siddhesh Poyarekar wrote:
> On Wed, Feb 19, 2014 at 12:50:53AM -0500, Rich Felker wrote:
> > I looked briefly at the patch and I don't see anything particularly
> > wrong about it; at least it doesn't seem to make anything worse and
> > looks like it fixes the particular issue. But I suspect you might end
> > up removing or at least rewriting/moving this logic in fixing #16605.
> 
> You're right.  I guess writes to the FILE pointer object should be
> forbidden in ftell altogether, since it does not serve any purpose.

I'm not sure what you mean by this. Certainly at least some writes are
required, e.g. obtaining the lock. But I think you can still cache the
offset as long as the FILE is currently reading or writing. One easy
way to know you can cache the offset is when the buffer is non-empty,
but there also seem to be some cases where you can cache it even when
the buffer is empty; I'm not sure if it's worth optimizing for those
too.

Rich


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