[PATCH v2] libio: Fix stream orientation when using fread [BZ #22796]

Sam Zeter samuelzeter@gmail.com
Wed Mar 19 11:30:06 GMT 2025


> Aren't there are other xsgetn methods for different stream types?  Then
> this change will not fix them.

Thanks for the response. Unfortunately I'm new to this codebase and not
entirely sure what other methods you mean for different stream types.
I thought the issue only affected this particular call to fread.

> I think it's better to leave orientation handling to the external
> interface (so for example, __underflow (for getc_unlocked) and fread).

I'm also not sure what you mean by leaving orientation handling to the
external interface, when __underflow() itself is being called by
_IO_file_xsgetn(), at least in my test I wrote for fread. Wouldn't
that make _IO_file_xsgetn() the external interface?

I do now see __getdelim() uses __underflow() and the stream setting
I removed is probably needed there.

Thanks in advance
Sam.


More information about the Libc-alpha mailing list