[PATCH] newlib: fix fseek optimization with SEEK_CUR

Corinna Vinschen vinschen@redhat.com
Wed Nov 13 10:15:00 GMT 2019

Hi Bastien,

On Nov  9 17:28, Bastien Bouclet wrote:
> The call to fflush was invalidating the read buffer, preventing relative
> seeks to positions that would have been inside the read buffer from
> being optimized. The call to srefill would then re-read mostly the same
> data that was initially in the read buffer.

I checked this against upstream BSD versions.  OpenBSD and NetBSD
operate like our code, including the flush, while FreeBSD uses its
internal ftello and never flushed since the repository import back in

I'm pretty unsure if we can do this.  Apparently the flush op is only
necessary for streams in append mode.  If at all.

Can we be sure this works as desired on append streams as well?

Also, given that this is changing very basic code, nobody is unaffected.
Any input from other folks?


Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20191113/9be00e99/attachment.sig>

More information about the Newlib mailing list