[PATCH 2/6] Make fclose seek input file to right offset (bug 12724)

DJ Delorie dj@redhat.com
Wed Jan 15 20:01:39 GMT 2025


Joseph Myers <josmyers@redhat.com> writes:
>> Must undo any unused read-ahead in the main buffer.  IO_SEEKOFF doesn't
>> check for the dual buffer state so only undoes the ungetc buffer.
>> 
>> Why can't this fix be in the IO_SEEKOFF logic?  Doesn't this imply that
>> IO_SEEKOFF is faulty?
>
> I don't know why the interface is designed the way it is, but all of 
> ftell, ftello, ftello64, fgetpos and fgetpos64 work with the IO_SEEKOFF 
> interface as it is (i.e., making this adjustment in the caller).

Odd.  Perhaps someone "fixed" it the easy way once, and that propogated
until it became a standard.  Sigh.

LGTM then.
Reviewed-by: DJ Delorie <dj@redhat.com>



More information about the Libc-alpha mailing list