1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

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>
This commit is contained in:
Frédéric Bérat
2023-06-01 12:40:05 -04:00
committed by Siddhesh Poyarekar
parent a8c8889978
commit 026a84a54d
32 changed files with 84 additions and 39 deletions

View File

@ -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);

View File

@ -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)
{

View File

@ -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,

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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