[PATCH v2] tst-fopen-threaded: Only check EOF for failing read
Florian Weimer
fweimer@redhat.com
Fri Mar 14 16:26:46 GMT 2025
* Siddhesh Poyarekar:
> The fread race checker looks for EOF in every thread, which is incorrect
> since threads calling fread successfully could lag behind and read the
> EOF condition, resulting in multiple threads thinking that they
> encountered an EOF.
>
> Only look for EOF condition if fread fails to read a char. Also drop
> the clearerr() since it could mask the failure of another reader, thus
> hiding a test failure.
>
> Finally, also check for error in the stream for completeness.
>
> Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
> ---
> sysdeps/pthread/tst-fopen-threaded.c | 28 ++++++++++++++++++----------
> 1 file changed, 18 insertions(+), 10 deletions(-)
This version looks good to me.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Thanks,
Florian
More information about the Libc-alpha
mailing list