aboutsummaryrefslogtreecommitdiff
path: root/nptl/tst-basic1.c
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>2016-10-31 22:09:12 -0200
committerGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>2016-11-07 22:09:42 -0200
commite0c6851980806f2a51b37e3e37fc9a48420a4a83 (patch)
treef92bf9d475e48293155946e53dcef64a40f94c0c /nptl/tst-basic1.c
parentd5b38790950533e80d1fc7c79cab4eacef626547 (diff)
downloadglibc-e0c6851980806f2a51b37e3e37fc9a48420a4a83.zip
glibc-e0c6851980806f2a51b37e3e37fc9a48420a4a83.tar.gz
glibc-e0c6851980806f2a51b37e3e37fc9a48420a4a83.tar.bz2
Write messages to stdout and use write_message instead of write
Replaces calls to write on file descriptor 2 with calls to write_message, which writes to STDOUT_FILENO (1) and properly deals with the return of write.
Diffstat (limited to 'nptl/tst-basic1.c')
-rw-r--r--nptl/tst-basic1.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/nptl/tst-basic1.c b/nptl/tst-basic1.c
index 8ea4523..72c6234 100644
--- a/nptl/tst-basic1.c
+++ b/nptl/tst-basic1.c
@@ -22,6 +22,11 @@
#include <sys/types.h>
+static int do_test (void);
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
static pid_t pid;
static void *
@@ -29,7 +34,7 @@ tf (void *a)
{
if (getpid () != pid)
{
- write (2, "pid mismatch\n", 13);
+ write_message ("pid mismatch\n");
_exit (1);
}
@@ -49,7 +54,7 @@ do_test (void)
for (i = 0; i < N; ++i)
if (pthread_create (&t[i], NULL, tf, (void *) (long int) (i + 1)) != 0)
{
- write (2, "create failed\n", 14);
+ write_message ("create failed\n");
_exit (1);
}
else
@@ -66,7 +71,7 @@ do_test (void)
}
else if (r != (void *) (long int) (i + 1))
{
- write (2, "result wrong\n", 13);
+ write_message ("result wrong\n");
_exit (1);
}
else
@@ -75,7 +80,3 @@ do_test (void)
return 0;
}
-
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"