From: "Frédéric Bérat" <fberat@redhat.com>
To: libc-alpha@sourceware.org
Cc: siddhesh@gotplt.org, fberat@redhat.com
Subject: [PATCH v4 08/15] tests: replace write by xwrite
Date: Fri, 28 Apr 2023 14:21:35 +0200 [thread overview]
Message-ID: <20230428122142.928135-9-fberat@redhat.com> (raw)
In-Reply-To: <20230418121130.844302-2-fberat@redhat.com>
Using write without cheks leads to warn unused result when __wur is
enabled.
---
dirent/tst-fdopendir.c | 4 +++-
io/tst-faccessat.c | 3 ++-
io/tst-fchmodat.c | 3 ++-
io/tst-fchownat.c | 3 ++-
io/tst-fstatat.c | 3 ++-
io/tst-futimesat.c | 3 ++-
io/tst-linkat.c | 3 ++-
io/tst-openat.c | 3 ++-
io/tst-renameat.c | 3 ++-
io/tst-symlinkat.c | 3 ++-
io/tst-unlinkat.c | 3 ++-
libio/bug-ungetc.c | 4 +++-
libio/bug-ungetc3.c | 4 +++-
libio/bug-ungetc4.c | 4 +++-
libio/bug-wfflush.c | 4 +++-
libio/bug-wsetpos.c | 4 +++-
nptl/tst-stackguard1.c | 4 +++-
nptl/tst-tls3.c | 2 ++
nptl/tst-tls3mod.c | 5 +++--
rt/tst-cpuclock2.c | 4 +++-
rt/tst-cputimer1.c | 4 +++-
rt/tst-cputimer2.c | 4 +++-
rt/tst-cputimer3.c | 4 +++-
support/test-container.c | 8 ++++----
sysdeps/pthread/tst-cond18.c | 4 +++-
sysdeps/pthread/tst-flock1.c | 3 ++-
sysdeps/pthread/tst-flock2.c | 3 ++-
sysdeps/pthread/tst-key1.c | 11 ++++++-----
sysdeps/pthread/tst-signal1.c | 3 ++-
sysdeps/pthread/tst-signal2.c | 3 ++-
sysdeps/pthread/tst-timer.c | 3 ++-
time/tst-cpuclock1.c | 4 +++-
32 files changed, 84 insertions(+), 39 deletions(-)
diff --git a/dirent/tst-fdopendir.c b/dirent/tst-fdopendir.c
index 6321af1daa..2c9520574d 100644
--- a/dirent/tst-fdopendir.c
+++ b/dirent/tst-fdopendir.c
@@ -7,6 +7,8 @@
#include <string.h>
#include <sys/stat.h>
+#include <support/xunistd.h>
+
#ifndef O_NOATIME
# define O_NOATIME 0
#endif
@@ -22,7 +24,7 @@ do_test (void)
return 1;
}
- write (fd, "hello", 5);
+ xwrite (fd, "hello", 5);
close (fd);
struct stat64 st;
diff --git a/io/tst-faccessat.c b/io/tst-faccessat.c
index 7bdeed008c..b90954e318 100644
--- a/io/tst-faccessat.c
+++ b/io/tst-faccessat.c
@@ -8,6 +8,7 @@
#include <unistd.h>
#include <sys/stat.h>
+#include <support/xunistd.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
@@ -96,7 +97,7 @@ do_test (void)
puts ("file creation failed");
return 1;
}
- write (fd, "hello", 5);
+ xwrite (fd, "hello", 5);
puts ("file created");
/* Before closing the file, try using this file descriptor to open
diff --git a/io/tst-fchmodat.c b/io/tst-fchmodat.c
index 7d4a8717ff..83003e2f21 100644
--- a/io/tst-fchmodat.c
+++ b/io/tst-fchmodat.c
@@ -8,6 +8,7 @@
#include <unistd.h>
#include <sys/stat.h>
+#include <support/xunistd.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
@@ -98,7 +99,7 @@ do_test (void)
puts ("file creation failed");
return 1;
}
- write (fd, "hello", 5);
+ xwrite (fd, "hello", 5);
puts ("file created");
struct stat64 st1;
diff --git a/io/tst-fchownat.c b/io/tst-fchownat.c
index e8adf6229f..c0b87cda8f 100644
--- a/io/tst-fchownat.c
+++ b/io/tst-fchownat.c
@@ -6,6 +6,7 @@
#include <unistd.h>
#include <sys/stat.h>
+#include <support/xunistd.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
@@ -106,7 +107,7 @@ do_test (void)
puts ("file creation failed");
return 1;
}
- write (fd, "hello", 5);
+ xwrite (fd, "hello", 5);
puts ("file created");
struct stat64 st1;
diff --git a/io/tst-fstatat.c b/io/tst-fstatat.c
index 4766bb2e71..6a60024b63 100644
--- a/io/tst-fstatat.c
+++ b/io/tst-fstatat.c
@@ -6,6 +6,7 @@
#include <unistd.h>
#include <sys/stat.h>
+#include <support/xunistd.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
@@ -94,7 +95,7 @@ do_test (void)
puts ("file creation failed");
return 1;
}
- write (fd, "hello", 5);
+ xwrite (fd, "hello", 5);
puts ("file created");
struct stat64 st1;
diff --git a/io/tst-futimesat.c b/io/tst-futimesat.c
index 3d41721f42..b7ef386e06 100644
--- a/io/tst-futimesat.c
+++ b/io/tst-futimesat.c
@@ -28,6 +28,7 @@
#include <support/test-driver.h>
#include <support/temp_file.h>
+#include <support/xunistd.h>
#ifndef struct_stat
# define struct_stat struct stat64
@@ -114,7 +115,7 @@ do_test (void)
puts ("file creation failed");
return 1;
}
- write (fd, "hello", 5);
+ xwrite (fd, "hello", 5);
puts ("file created");
struct_stat st1;
diff --git a/io/tst-linkat.c b/io/tst-linkat.c
index 97445b7954..6b22a01c88 100644
--- a/io/tst-linkat.c
+++ b/io/tst-linkat.c
@@ -6,6 +6,7 @@
#include <unistd.h>
#include <sys/stat.h>
+#include <support/xunistd.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
@@ -94,7 +95,7 @@ do_test (void)
puts ("file creation failed");
return 1;
}
- write (fd, "hello", 5);
+ xwrite (fd, "hello", 5);
puts ("file created");
struct stat64 st1;
diff --git a/io/tst-openat.c b/io/tst-openat.c
index 741b8d0ad2..2ce89e3db1 100644
--- a/io/tst-openat.c
+++ b/io/tst-openat.c
@@ -6,6 +6,7 @@
#include <string.h>
#include <unistd.h>
+#include <support/xunistd.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
@@ -94,7 +95,7 @@ do_test (void)
puts ("file creation failed");
return 1;
}
- write (fd, "hello", 5);
+ xwrite (fd, "hello", 5);
/* Before closing the file, try using this file descriptor to open
another file. This must fail. */
diff --git a/io/tst-renameat.c b/io/tst-renameat.c
index 435302b52b..0b9da5fd6d 100644
--- a/io/tst-renameat.c
+++ b/io/tst-renameat.c
@@ -6,6 +6,7 @@
#include <unistd.h>
#include <sys/stat.h>
+#include <support/xunistd.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
@@ -94,7 +95,7 @@ do_test (void)
puts ("file creation failed");
return 1;
}
- write (fd, "hello", 5);
+ xwrite (fd, "hello", 5);
puts ("file created");
struct stat64 st1;
diff --git a/io/tst-symlinkat.c b/io/tst-symlinkat.c
index 214a8e348e..4a34994df7 100644
--- a/io/tst-symlinkat.c
+++ b/io/tst-symlinkat.c
@@ -6,6 +6,7 @@
#include <unistd.h>
#include <sys/stat.h>
+#include <support/xunistd.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
@@ -94,7 +95,7 @@ do_test (void)
puts ("file creation failed");
return 1;
}
- write (fd, "hello", 5);
+ xwrite (fd, "hello", 5);
puts ("file created");
struct stat64 st1;
diff --git a/io/tst-unlinkat.c b/io/tst-unlinkat.c
index e21d56f9f7..21a2dbaf57 100644
--- a/io/tst-unlinkat.c
+++ b/io/tst-unlinkat.c
@@ -6,6 +6,7 @@
#include <string.h>
#include <unistd.h>
+#include <support/xunistd.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
@@ -94,7 +95,7 @@ do_test (void)
puts ("file creation failed");
return 1;
}
- write (fd, "hello", 5);
+ xwrite (fd, "hello", 5);
close (fd);
puts ("file created");
diff --git a/libio/bug-ungetc.c b/libio/bug-ungetc.c
index 51940b68f5..4ea2d14ed6 100644
--- a/libio/bug-ungetc.c
+++ b/libio/bug-ungetc.c
@@ -2,6 +2,8 @@
#include <stdio.h>
+#include <support/xunistd.h>
+
static void do_prepare (void);
#define PREPARE(argc, argv) do_prepare ()
static int do_test (void);
@@ -20,7 +22,7 @@ do_prepare (void)
printf ("cannot create temporary file: %m\n");
exit (1);
}
- write (fd, pattern, sizeof (pattern));
+ xwrite (fd, pattern, sizeof (pattern));
close (fd);
}
diff --git a/libio/bug-ungetc3.c b/libio/bug-ungetc3.c
index 0c83c1161e..6100d7a936 100644
--- a/libio/bug-ungetc3.c
+++ b/libio/bug-ungetc3.c
@@ -2,6 +2,8 @@
#include <stdio.h>
+#include <support/xunistd.h>
+
static void do_prepare (void);
#define PREPARE(argc, argv) do_prepare ()
static int do_test (void);
@@ -20,7 +22,7 @@ do_prepare (void)
printf ("cannot create temporary file: %m\n");
exit (1);
}
- write (fd, pattern, sizeof (pattern));
+ xwrite (fd, pattern, sizeof (pattern));
close (fd);
}
diff --git a/libio/bug-ungetc4.c b/libio/bug-ungetc4.c
index 0bd02a570d..8a05def686 100644
--- a/libio/bug-ungetc4.c
+++ b/libio/bug-ungetc4.c
@@ -18,6 +18,8 @@
#include <stdio.h>
+#include <support/xunistd.h>
+
static void do_prepare (void);
#define PREPARE(argc, argv) do_prepare ()
static int do_test (void);
@@ -36,7 +38,7 @@ do_prepare (void)
printf ("cannot create temporary file: %m\n");
exit (1);
}
- write (fd, pattern, sizeof (pattern) - 1);
+ xwrite (fd, pattern, sizeof (pattern) - 1);
close (fd);
}
diff --git a/libio/bug-wfflush.c b/libio/bug-wfflush.c
index a8fd61e997..d1b9d8e9de 100644
--- a/libio/bug-wfflush.c
+++ b/libio/bug-wfflush.c
@@ -3,6 +3,8 @@
#include <stdio.h>
#include <wchar.h>
+#include <support/xunistd.h>
+
static void do_prepare (void);
#define PREPARE(argc, argv) do_prepare ()
static int do_test (void);
@@ -20,7 +22,7 @@ do_prepare (void)
printf ("cannot create temporary file: %m\n");
exit (1);
}
- write (fd, "1!", 2);
+ xwrite (fd, "1!", 2);
close (fd);
}
diff --git a/libio/bug-wsetpos.c b/libio/bug-wsetpos.c
index ccb22a4b62..0fc373ba49 100644
--- a/libio/bug-wsetpos.c
+++ b/libio/bug-wsetpos.c
@@ -4,6 +4,8 @@
#include <stdio.h>
#include <wchar.h>
+#include <support/xunistd.h>
+
static void do_prepare (void);
#define PREPARE(argc, argv) do_prepare ()
static int do_test (void);
@@ -22,7 +24,7 @@ do_prepare (void)
printf ("cannot create temporary file: %m\n");
exit (1);
}
- write (fd, pattern, sizeof (pattern));
+ xwrite (fd, pattern, sizeof (pattern));
close (fd);
}
diff --git a/nptl/tst-stackguard1.c b/nptl/tst-stackguard1.c
index b9cf6844de..4ac57157e9 100644
--- a/nptl/tst-stackguard1.c
+++ b/nptl/tst-stackguard1.c
@@ -27,6 +27,8 @@
#include <tls.h>
#include <unistd.h>
+#include <support/xunistd.h>
+
static const char *command;
static bool child;
static uintptr_t stack_chk_guard_copy;
@@ -96,7 +98,7 @@ do_test (void)
else if (ret != NULL)
return 1;
- write (2, &stack_chk_guard_copy, sizeof (stack_chk_guard_copy));
+ xwrite (2, &stack_chk_guard_copy, sizeof (stack_chk_guard_copy));
return 0;
}
diff --git a/nptl/tst-tls3.c b/nptl/tst-tls3.c
index b1a40c624a..33d94c8cc5 100644
--- a/nptl/tst-tls3.c
+++ b/nptl/tst-tls3.c
@@ -26,6 +26,8 @@
#include <unistd.h>
#include <pthreaddef.h>
+#include <support/xunistd.h>
+
#define THE_SIG SIGUSR1
/* The stack size can be overriden. With a sufficiently large stack
diff --git a/nptl/tst-tls3mod.c b/nptl/tst-tls3mod.c
index c6e8910b1e..345a48e1c7 100644
--- a/nptl/tst-tls3mod.c
+++ b/nptl/tst-tls3mod.c
@@ -25,6 +25,7 @@
#include <pthreaddef.h>
#include <descr.h>
+#include <support/xunistd.h>
extern pthread_barrier_t b;
@@ -43,7 +44,7 @@ handler (int sig)
{
if (sig != THE_SIG)
{
- write (STDOUT_FILENO, "wrong signal\n", 13);
+ xwrite (STDOUT_FILENO, "wrong signal\n", 13);
_exit (1);
}
@@ -51,7 +52,7 @@ handler (int sig)
if (sem_post (&s) != 0)
{
- write (STDOUT_FILENO, "sem_post failed\n", 16);
+ xwrite (STDOUT_FILENO, "sem_post failed\n", 16);
_exit (1);
}
}
diff --git a/rt/tst-cpuclock2.c b/rt/tst-cpuclock2.c
index e4584d8791..8afd34ed9c 100644
--- a/rt/tst-cpuclock2.c
+++ b/rt/tst-cpuclock2.c
@@ -37,6 +37,8 @@ do_test ()
#include <errno.h>
#include <pthread.h>
+#include <support/xunistd.h>
+
static pthread_barrier_t barrier;
/* This function is intended to rack up both user and system time. */
@@ -55,7 +57,7 @@ chew_cpu (void *arg)
for (int i = 0; i < 100; ++i)
for (size_t j = 0; j < sizeof buf; ++j)
buf[j] = 0xbb;
- write (nullfd, (char *) buf, sizeof buf);
+ xwrite (nullfd, (char *) buf, sizeof buf);
close (nullfd);
}
diff --git a/rt/tst-cputimer1.c b/rt/tst-cputimer1.c
index 8f5dd76cf2..18d8b195a2 100644
--- a/rt/tst-cputimer1.c
+++ b/rt/tst-cputimer1.c
@@ -11,6 +11,8 @@
#include <time.h>
#include <pthread.h>
+#include <support/xunistd.h>
+
#define TEST_CLOCK CLOCK_PROCESS_CPUTIME_ID
#define TEST_CLOCK_MISSING(clock) \
(setup_test () ? "process CPU clock timer support" : NULL)
@@ -29,7 +31,7 @@ chew_cpu (void *arg)
for (int i = 0; i < 100; ++i)
for (size_t j = 0; j < sizeof buf; ++j)
buf[j] = 0xbb;
- write (nullfd, (char *) buf, sizeof buf);
+ xwrite (nullfd, (char *) buf, sizeof buf);
close (nullfd);
}
diff --git a/rt/tst-cputimer2.c b/rt/tst-cputimer2.c
index 397d7998c0..a5700d4bac 100644
--- a/rt/tst-cputimer2.c
+++ b/rt/tst-cputimer2.c
@@ -12,6 +12,8 @@
#include <time.h>
#include <pthread.h>
+#include <support/xunistd.h>
+
static clockid_t worker_thread_clock;
#define TEST_CLOCK worker_thread_clock
@@ -32,7 +34,7 @@ chew_cpu (void *arg)
for (int i = 0; i < 100; ++i)
for (size_t j = 0; j < sizeof buf; ++j)
buf[j] = 0xbb;
- write (nullfd, (char *) buf, sizeof buf);
+ xwrite (nullfd, (char *) buf, sizeof buf);
close (nullfd);
}
diff --git a/rt/tst-cputimer3.c b/rt/tst-cputimer3.c
index 056766a377..786de93a02 100644
--- a/rt/tst-cputimer3.c
+++ b/rt/tst-cputimer3.c
@@ -13,6 +13,8 @@
#include <signal.h>
#include <sys/wait.h>
+#include <support/xunistd.h>
+
static clockid_t child_clock;
#define TEST_CLOCK child_clock
@@ -33,7 +35,7 @@ chew_cpu (void)
for (int i = 0; i < 100; ++i)
for (size_t j = 0; j < sizeof buf; ++j)
buf[j] = 0xbb;
- write (nullfd, (char *) buf, sizeof buf);
+ xwrite (nullfd, (char *) buf, sizeof buf);
close (nullfd);
if (getppid () == 1)
_exit (2);
diff --git a/support/test-container.c b/support/test-container.c
index e68f16eecf..d4ca41fe7c 100644
--- a/support/test-container.c
+++ b/support/test-container.c
@@ -1186,7 +1186,7 @@ main (int argc, char **argv)
int status;
/* Send the child's "outside" pid to it. */
- write (pipes[1], &child, sizeof(child));
+ xwrite (pipes[1], &child, sizeof(child));
close (pipes[0]);
close (pipes[1]);
@@ -1255,7 +1255,7 @@ main (int argc, char **argv)
sprintf (tmp, "%lld %lld 1\n",
(long long) (be_su ? 0 : original_uid), (long long) original_uid);
- write (UMAP, tmp, strlen (tmp));
+ xwrite (UMAP, tmp, strlen (tmp));
xclose (UMAP);
/* We must disable setgroups () before we can map our groups, else we
@@ -1264,7 +1264,7 @@ main (int argc, char **argv)
if (GMAP >= 0)
{
/* We support kernels old enough to not have this. */
- write (GMAP, "deny\n", 5);
+ xwrite (GMAP, "deny\n", 5);
xclose (GMAP);
}
@@ -1276,7 +1276,7 @@ main (int argc, char **argv)
sprintf (tmp, "%lld %lld 1\n",
(long long) (be_su ? 0 : original_gid), (long long) original_gid);
- write (GMAP, tmp, strlen (tmp));
+ xwrite (GMAP, tmp, strlen (tmp));
xclose (GMAP);
}
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
diff --git a/time/tst-cpuclock1.c b/time/tst-cpuclock1.c
index 6f2e70a58a..6a793e06df 100644
--- a/time/tst-cpuclock1.c
+++ b/time/tst-cpuclock1.c
@@ -27,6 +27,8 @@
#include <stdint.h>
#include <sys/wait.h>
+#include <support/xunistd.h>
+
/* This function is intended to rack up both user and system time. */
static void
chew_cpu (void)
@@ -41,7 +43,7 @@ chew_cpu (void)
for (int i = 0; i < 100; ++i)
for (size_t j = 0; j < sizeof buf; ++j)
buf[j] = 0xbb;
- write (nullfd, (char *) buf, sizeof buf);
+ xwrite (nullfd, (char *) buf, sizeof buf);
close (nullfd);
if (getppid () == 1)
_exit (2);
--
2.39.2
next prev parent reply other threads:[~2023-04-28 12:35 UTC|newest]
Thread overview: 109+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 12:11 [PATCH 0/8] Fix warn unused result Frédéric Bérat
2023-04-18 12:11 ` [PATCH 1/8] tests: fix " Frédéric Bérat
2023-04-18 12:23 ` Siddhesh Poyarekar
2023-04-28 12:21 ` [PATCH v4 07/15] tests: fix warn unused result on asprintf calls Frédéric Bérat
2023-05-25 1:07 ` Siddhesh Poyarekar
2023-05-31 14:36 ` Frederic Berat
2023-04-28 12:21 ` Frédéric Bérat [this message]
2023-05-25 1:16 ` [PATCH v4 08/15] tests: replace write by xwrite Siddhesh Poyarekar
2023-06-01 16:39 ` Siddhesh Poyarekar
2023-04-28 12:21 ` [PATCH v4 09/15] tests: replace read by xread Frédéric Bérat
2023-04-28 12:21 ` [PATCH v4 10/15] tests: replace system by xsystem Frédéric Bérat
2023-05-25 1:22 ` Siddhesh Poyarekar
2023-04-28 12:21 ` [PATCH v4 11/15] tests: replace fread by xfread Frédéric Bérat
2023-04-28 12:21 ` [PATCH v4 12/15] tests: replace ftruncate by xftruncate Frédéric Bérat
2023-05-25 1:25 ` Siddhesh Poyarekar
2023-06-01 16:42 ` Siddhesh Poyarekar
2023-04-28 12:21 ` [PATCH v4 13/15] tests: replace fgets by xfgets Frédéric Bérat
2023-04-28 12:21 ` [PATCH v4 14/15] tests: Replace various function calls with their x variant Frédéric Bérat
2023-05-25 1:29 ` Siddhesh Poyarekar
2023-05-25 16:10 ` Frederic Berat
2023-04-28 12:21 ` [PATCH v4 15/15] tests: fix warn unused results Frédéric Bérat
2023-05-25 1:35 ` Siddhesh Poyarekar
2023-06-01 14:27 ` [PATCH v5 04/12] tests: fix warn unused result on asprintf calls Frédéric Bérat
2023-06-01 16:52 ` Siddhesh Poyarekar
2023-06-01 14:27 ` [PATCH v5 07/12] tests: replace system by xsystem Frédéric Bérat
2023-06-01 16:56 ` Siddhesh Poyarekar
2023-06-01 14:27 ` [PATCH v5 12/12] tests: fix warn unused results Frédéric Bérat
2023-06-01 16:57 ` Siddhesh Poyarekar
2023-04-18 12:11 ` [PATCH 2/8] catgets/gencat.c: fix warn unused result Frédéric Bérat
2023-04-18 12:36 ` Siddhesh Poyarekar
2023-04-28 12:21 ` [PATCH v4 01/15] " Frédéric Bérat
2023-05-24 22:47 ` Siddhesh Poyarekar
2023-06-01 14:27 ` [PATCH v5 01/12] " Frédéric Bérat
2023-06-01 16:47 ` Siddhesh Poyarekar
2023-04-18 12:11 ` [PATCH 3/8] inet/rcmd.c: " Frédéric Bérat
2023-04-18 12:37 ` Siddhesh Poyarekar
2023-04-18 13:40 ` Andreas Schwab
2023-04-18 13:50 ` Siddhesh Poyarekar
2023-04-18 12:11 ` [PATCH 4/8] locale/programs/locarchive.c: " Frédéric Bérat
2023-04-18 12:43 ` Siddhesh Poyarekar
2023-04-28 12:21 ` [PATCH v4 02/15] " Frédéric Bérat
2023-05-24 22:49 ` Siddhesh Poyarekar
2023-06-01 14:27 ` [PATCH v5 02/12] malloc/{memusage.c,memusagestat.c}: " Frédéric Bérat
2023-06-01 16:49 ` Siddhesh Poyarekar
2023-04-18 12:11 ` [PATCH 5/8] " Frédéric Bérat
2023-04-18 12:47 ` [PATCH 5/8] malloc/{memusage.c, memusagestat.c}: " Siddhesh Poyarekar
2023-04-28 12:21 ` [PATCH v4 03/15] malloc/{memusage.c,memusagestat.c}: " Frédéric Bérat
2023-05-25 0:50 ` Siddhesh Poyarekar
2023-06-01 15:55 ` [PATCH] Move {read,write}_all functions to a dedicated header Frédéric Bérat
2023-06-01 17:07 ` Siddhesh Poyarekar
2023-06-02 6:10 ` Frederic Berat
2023-06-02 10:01 ` Siddhesh Poyarekar
2023-04-18 12:11 ` [PATCH 6/8] nptl_db/thread_dbP.h: fix warn unused result Frédéric Bérat
2023-04-18 12:49 ` Siddhesh Poyarekar
2023-04-18 12:51 ` Siddhesh Poyarekar
2023-04-28 12:21 ` [PATCH v4 04/15] " Frédéric Bérat
2023-05-25 0:51 ` Siddhesh Poyarekar
2023-05-25 1:52 ` Siddhesh Poyarekar
2023-06-01 14:27 ` [PATCH v5 03/12] " Frédéric Bérat
2023-06-01 16:49 ` Siddhesh Poyarekar
2023-04-18 12:11 ` [PATCH 7/8] sunrpc/netname.c: " Frédéric Bérat
2023-04-18 12:51 ` Siddhesh Poyarekar
2023-04-28 12:21 ` [PATCH v4 05/15] " Frédéric Bérat
2023-05-25 0:53 ` Siddhesh Poyarekar
2023-04-18 12:11 ` [PATCH 8/8] sysdeps/pthread/eintr.c: " Frédéric Bérat
2023-04-18 12:54 ` Siddhesh Poyarekar
2023-04-28 12:21 ` [PATCH v4 06/15] " Frédéric Bérat
2023-05-25 0:59 ` Siddhesh Poyarekar
2023-04-28 12:21 ` [PATCH v4 00/15] Fix " Frédéric Bérat
2023-05-25 1:53 ` Siddhesh Poyarekar
2023-06-02 15:28 ` [PATCH v6 0/7] " Frédéric Bérat
2023-06-02 15:28 ` [PATCH v6 1/7] tests: fix warn unused result on asprintf calls Frédéric Bérat
2023-06-06 6:18 ` Siddhesh Poyarekar
2023-06-02 15:28 ` [PATCH v6 2/7] tests: replace read by xread Frédéric Bérat
2023-06-06 6:21 ` Siddhesh Poyarekar
2023-06-06 8:00 ` Frederic Berat
2023-06-12 14:22 ` Siddhesh Poyarekar
2023-06-07 19:04 ` Frederic Berat
2023-06-02 15:28 ` [PATCH v6 3/7] tests: replace system by xsystem Frédéric Bérat
2023-06-06 12:17 ` Siddhesh Poyarekar
2023-06-02 15:28 ` [PATCH v6 4/7] tests: replace fread by xfread Frédéric Bérat
2023-06-06 12:18 ` Siddhesh Poyarekar
2023-06-07 19:03 ` Frederic Berat
2023-06-02 15:28 ` [PATCH v6 5/7] tests: replace fgets by xfgets Frédéric Bérat
2023-06-06 12:20 ` Siddhesh Poyarekar
2023-06-08 5:50 ` Maxim Kuvyrkov
2023-06-08 6:57 ` Frederic Berat
2023-06-02 15:28 ` [PATCH v6 6/7] tests: Replace various function calls with their x variant Frédéric Bérat
2023-06-06 12:20 ` Siddhesh Poyarekar
2023-06-02 15:28 ` [PATCH v6 7/7] Move {read,write}_all functions to a dedicated header Frédéric Bérat
2023-06-06 12:21 ` Siddhesh Poyarekar
2023-06-12 15:18 ` [PATCH v7 0/4] Fix warn unused result Frédéric Bérat
2023-06-12 15:18 ` [PATCH v7 1/4] tests: replace read by xread Frédéric Bérat
2023-06-12 16:57 ` Joseph Myers
2023-06-13 14:22 ` Frederic Berat
2023-06-14 8:52 ` [PATCH v8 1/2] " Frédéric Bérat
2023-06-14 11:51 ` Siddhesh Poyarekar
2023-06-12 15:18 ` [PATCH v7 2/4] tests: replace system by xsystem Frédéric Bérat
2023-06-13 14:10 ` Siddhesh Poyarekar
2023-06-13 14:13 ` Adhemerval Zanella Netto
2023-06-13 14:16 ` Siddhesh Poyarekar
2023-06-14 8:52 ` [PATCH 2/2] " Frédéric Bérat
2023-06-14 11:53 ` Siddhesh Poyarekar
2023-06-12 15:18 ` [PATCH v7 3/4] tests: replace fread by xfread Frédéric Bérat
2023-06-13 23:57 ` Siddhesh Poyarekar
2023-06-12 15:18 ` [PATCH v7 4/4] tests: replace fgets by xfgets Frédéric Bérat
2023-06-13 12:23 ` Siddhesh Poyarekar
2023-06-13 18:25 ` Joseph Myers
2023-06-13 23:56 ` Siddhesh Poyarekar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230428122142.928135-9-fberat@redhat.com \
--to=fberat@redhat.com \
--cc=libc-alpha@sourceware.org \
--cc=siddhesh@gotplt.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).