[PATCH] tst-fopen-threaded: Only check EOF for failing read
Florian Weimer
fweimer@redhat.com
Fri Mar 14 15:29:10 GMT 2025
* Siddhesh Poyarekar:
>> You don't mention anywhere why you remove the clearerr call? I think
>> that's necessary because the test assumes that feof is sticky.
>
> Would it change the outcome though? If there are multiple failing
> readers, they would reliably result in the test failing regardless of
> whether the EOF/error flag is cleared.
I think you get another race if you leave in the clearerr because a
reader that sees EOF in fread (0 return) might not observe ot in feof
because it got reverted by a concurrent clearerr (which clears the EOF
indicator, too).
(By the way, it's not clear from the patch context that ret == 0 is
correct here, that's because sizeof (read_buffer) is 1 is as well. So
the short read scenario cannot really happen.)
Thanks,
Florian
More information about the Libc-alpha
mailing list