about summary refs log tree commit diff
path: root/sysdeps/pthread
diff options
context:
space:
mode:
authorFrédéric Bérat <fberat@redhat.com>2023-06-01 12:40:05 -0400
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2023-06-01 12:40:05 -0400
commit026a84a54d3b6c23b999b793e2a6f8ecd211e3b8 (patch)
treea2d31c6c98b1de645aee08e9f8d907ec1961bd7d /sysdeps/pthread
parenta8c888997845c5192e446176374c2e13bb3e2195 (diff)
downloadglibc-026a84a54d3b6c23b999b793e2a6f8ecd211e3b8.tar.gz
glibc-026a84a54d3b6c23b999b793e2a6f8ecd211e3b8.tar.xz
glibc-026a84a54d3b6c23b999b793e2a6f8ecd211e3b8.zip
tests: replace write by xwrite
Using write without cheks leads to warn unused result when __wur is
enabled.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'sysdeps/pthread')
-rw-r--r--sysdeps/pthread/tst-cond18.c4
-rw-r--r--sysdeps/pthread/tst-flock1.c3
-rw-r--r--sysdeps/pthread/tst-flock2.c3
-rw-r--r--sysdeps/pthread/tst-key1.c11
-rw-r--r--sysdeps/pthread/tst-signal1.c3
-rw-r--r--sysdeps/pthread/tst-signal2.c3
-rw-r--r--sysdeps/pthread/tst-timer.c3
7 files changed, 19 insertions, 11 deletions
diff --git a/sysdeps/pthread/tst-cond18.c b/sysdeps/pthread/tst-cond18.c
index edac4fa4ff..ffae356c04 100644
--- a/sysdeps/pthread/tst-cond18.c
+++ b/sysdeps/pthread/tst-cond18.c
@@ -24,6 +24,8 @@
 #include <stdio.h>
 #include <unistd.h>
 
+#include <support/xunistd.h>
+
 pthread_cond_t cv = PTHREAD_COND_INITIALIZER;
 pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 bool exiting;
@@ -40,7 +42,7 @@ tf (void *id)
       while (!exiting)
 	{
 	  if ((spins++ % 1000) == 0)
-	    write (fd, ".", 1);
+	    xwrite (fd, ".", 1);
 	  pthread_mutex_unlock (&lock);
 
 	  pthread_mutex_lock (&lock);
diff --git a/sysdeps/pthread/tst-flock1.c b/sysdeps/pthread/tst-flock1.c
index 7eef9070ab..9de148afd3 100644
--- a/sysdeps/pthread/tst-flock1.c
+++ b/sysdeps/pthread/tst-flock1.c
@@ -21,6 +21,7 @@
 #include <unistd.h>
 #include <sys/file.h>
 
+#include <support/xunistd.h>
 
 static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 
@@ -56,7 +57,7 @@ do_test (void)
 
   unlink (tmp);
 
-  write (fd, "foobar xyzzy", 12);
+  xwrite (fd, "foobar xyzzy", 12);
 
   if (flock (fd, LOCK_EX | LOCK_NB) != 0)
     {
diff --git a/sysdeps/pthread/tst-flock2.c b/sysdeps/pthread/tst-flock2.c
index 8762e93b52..952b79e5db 100644
--- a/sysdeps/pthread/tst-flock2.c
+++ b/sysdeps/pthread/tst-flock2.c
@@ -24,6 +24,7 @@
 #include <sys/mman.h>
 #include <sys/wait.h>
 
+#include <support/xunistd.h>
 
 static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t lock2 = PTHREAD_MUTEX_INITIALIZER;
@@ -70,7 +71,7 @@ do_test (void)
 
   int i;
   for (i = 0; i < 20; ++i)
-    write (fd, "foobar xyzzy", 12);
+    xwrite (fd, "foobar xyzzy", 12);
 
   pthread_barrier_t *b;
   b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE,
diff --git a/sysdeps/pthread/tst-key1.c b/sysdeps/pthread/tst-key1.c
index 933edafef8..60245c4e47 100644
--- a/sysdeps/pthread/tst-key1.c
+++ b/sysdeps/pthread/tst-key1.c
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include <support/xunistd.h>
 
 static int do_test (void);
 
@@ -51,7 +52,7 @@ do_test (void)
 
 	if (pthread_setspecific (keys[i], (const void *) (i + 100l)) != 0)
 	  {
-	    write (2, "setspecific failed\n", 19);
+	    xwrite (2, "setspecific failed\n", 19);
 	    _exit (1);
 	  }
       }
@@ -60,13 +61,13 @@ do_test (void)
     {
       if (pthread_getspecific (keys[i]) != (void *) (i + 100l))
 	{
-	  write (2, "getspecific failed\n", 19);
+	  xwrite (2, "getspecific failed\n", 19);
 	  _exit (1);
 	}
 
       if (pthread_key_delete (keys[i]) != 0)
 	{
-	  write (2, "key_delete failed\n", 18);
+	  xwrite (2, "key_delete failed\n", 18);
 	  _exit (1);
 	}
     }
@@ -74,13 +75,13 @@ do_test (void)
   /* Now it must be once again possible to allocate keys.  */
   if (pthread_key_create (&keys[0], NULL) != 0)
     {
-      write (2, "2nd key_create failed\n", 22);
+      xwrite (2, "2nd key_create failed\n", 22);
       _exit (1);
     }
 
   if (pthread_key_delete (keys[0]) != 0)
     {
-      write (2, "2nd key_delete failed\n", 22);
+      xwrite (2, "2nd key_delete failed\n", 22);
       _exit (1);
     }
 
diff --git a/sysdeps/pthread/tst-signal1.c b/sysdeps/pthread/tst-signal1.c
index d1073e8459..d1082027ca 100644
--- a/sysdeps/pthread/tst-signal1.c
+++ b/sysdeps/pthread/tst-signal1.c
@@ -25,6 +25,7 @@
 #include <sys/mman.h>
 #include <sys/wait.h>
 
+#include <support/xunistd.h>
 
 static sigset_t ss;
 static pthread_barrier_t *b;
@@ -105,7 +106,7 @@ do_test (void)
 
   int i;
   for (i = 0; i < 20; ++i)
-    write (fd, "foobar xyzzy", 12);
+    xwrite (fd, "foobar xyzzy", 12);
 
   b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE,
 	    MAP_SHARED, fd, 0);
diff --git a/sysdeps/pthread/tst-signal2.c b/sysdeps/pthread/tst-signal2.c
index dfe7d9f64a..15b7747877 100644
--- a/sysdeps/pthread/tst-signal2.c
+++ b/sysdeps/pthread/tst-signal2.c
@@ -25,6 +25,7 @@
 #include <sys/wait.h>
 #include <string.h>
 
+#include <support/xunistd.h>
 
 static sigset_t ss;
 static pthread_barrier_t *b;
@@ -111,7 +112,7 @@ do_test (void)
 
   int i;
   for (i = 0; i < 20; ++i)
-    write (fd, "foobar xyzzy", 12);
+    xwrite (fd, "foobar xyzzy", 12);
 
   b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE,
 	    MAP_SHARED, fd, 0);
diff --git a/sysdeps/pthread/tst-timer.c b/sysdeps/pthread/tst-timer.c
index 47472ab8e1..4cfe0b67dc 100644
--- a/sysdeps/pthread/tst-timer.c
+++ b/sysdeps/pthread/tst-timer.c
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <stdint.h>
 
+#include <support/xunistd.h>
 
 static void
 notify_func1 (union sigval sigval)
@@ -44,7 +45,7 @@ signal_func (int sig)
 {
   static const char text[] = "signal_func\n";
   signal (sig, signal_func);
-  write (STDOUT_FILENO, text, sizeof text - 1);
+  xwrite (STDOUT_FILENO, text, sizeof text - 1);
 }
 
 static void