aboutsummaryrefslogtreecommitdiff
path: root/nptl/tst-key2.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-key2.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-key2.c')
-rw-r--r--nptl/tst-key2.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/nptl/tst-key2.c b/nptl/tst-key2.c
index 3142c86..4e6a9c2 100644
--- a/nptl/tst-key2.c
+++ b/nptl/tst-key2.c
@@ -23,6 +23,11 @@
#define N 2
+static int do_test (void);
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
static int cnt0;
static void
f0 (void *p)
@@ -53,7 +58,7 @@ tf (void *arg)
if (pthread_setspecific (*key, (void *) -1l) != 0)
{
- write (2, "setspecific failed\n", 19);
+ write_message ("setspecific failed\n");
_exit (1);
}
@@ -70,45 +75,41 @@ do_test (void)
for (i = 0; i < N; ++i)
if (pthread_key_create (&keys[i], fcts[i]) != 0)
{
- write (2, "key_create failed\n", 18);
+ write_message ("key_create failed\n");
_exit (1);
}
pthread_t th;
if (pthread_create (&th, NULL, tf, &keys[1]) != 0)
{
- write (2, "create failed\n", 14);
+ write_message ("create failed\n");
_exit (1);
}
if (pthread_join (th, NULL) != 0)
{
- write (2, "join failed\n", 12);
+ write_message ("join failed\n");
_exit (1);
}
if (cnt0 != 0)
{
- write (2, "cnt0 != 0\n", 10);
+ write_message ("cnt0 != 0\n");
_exit (1);
}
if (cnt1 != 1)
{
- write (2, "cnt1 != 1\n", 10);
+ write_message ("cnt1 != 1\n");
_exit (1);
}
for (i = 0; i < N; ++i)
if (pthread_key_delete (keys[i]) != 0)
{
- write (2, "key_delete failed\n", 18);
+ write_message ("key_delete failed\n");
_exit (1);
}
return 0;
}
-
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"