about summary refs log tree commit diff
path: root/nptl/tst-cleanup4.c
diff options
context:
space:
mode:
authorFrédéric Bérat <fberat@redhat.com>2023-06-14 10:52:06 +0200
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2023-06-19 09:14:56 -0400
commit20b6b8e8a50874dd189687df8f6f8a11d4813b34 (patch)
treedadbbe8e8c05cf8a9c647b9c9b3198c086fec475 /nptl/tst-cleanup4.c
parentcf30aa43a5917f441c9438aaee201c53c8e1d76b (diff)
downloadglibc-20b6b8e8a50874dd189687df8f6f8a11d4813b34.tar.gz
glibc-20b6b8e8a50874dd189687df8f6f8a11d4813b34.tar.xz
glibc-20b6b8e8a50874dd189687df8f6f8a11d4813b34.zip
tests: replace read by xread
With fortification enabled, read calls return result needs to be checked,
has it gets the __wur macro enabled.

Note on read call removal from  sysdeps/pthread/tst-cancel20.c and
sysdeps/pthread/tst-cancel21.c:
It is assumed that this second read call was there to overcome the race
condition between pipe closure and thread cancellation that could happen
in the original code. Since this race condition got fixed by
d0e3ffb7a58854248f1d5e737610d50cd0a60f46 the second call seems
superfluous. Hence, instead of checking for the return value of read, it
looks reasonable to simply remove it.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'nptl/tst-cleanup4.c')
-rw-r--r--nptl/tst-cleanup4.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/nptl/tst-cleanup4.c b/nptl/tst-cleanup4.c
index 1d3d53fb5f..f2e9f263e5 100644
--- a/nptl/tst-cleanup4.c
+++ b/nptl/tst-cleanup4.c
@@ -21,6 +21,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include <support/xunistd.h>
+
 /* LinuxThreads pthread_cleanup_{push,pop} helpers.  */
 extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer,
                                    void (*__routine) (void *),
@@ -64,7 +66,7 @@ fn_read (void)
     }
 
   char c;
-  read (fds[0], &c, 1);
+  xread (fds[0], &c, 1);
 }