diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-02-13 07:14:38 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-02-13 07:14:38 +0000 |
commit | dfdd294a2ac05a80908483846feb5343d4aac714 (patch) | |
tree | c6c2fdabffcf5e81cdf69dc2f78f8b437be6df5f /nptl/tst-atfork1.c | |
parent | 2067577c713671471ec03c52425625d69a19d1b4 (diff) | |
download | glibc-dfdd294a2ac05a80908483846feb5343d4aac714.zip glibc-dfdd294a2ac05a80908483846feb5343d4aac714.tar.gz glibc-dfdd294a2ac05a80908483846feb5343d4aac714.tar.bz2 |
Update.
* Makefile: Add rules to build and run tst-atfork2 test.
* tst-atfork2.c: New file.
* tst-atfork2mod.c: New file.
* sysdeps/unix/sysv/linux/unregister-atfork.c
(__unregister_atfork): Free the memory allocated for the handlers
after removing them from the lists.
* sysdeps/unix/sysv/linux/register-atfork.c: Define memeory
cleanup function.
* tst-atfork1.c (do_test): Wait for the child we forked.
Report error in child.
* sysdeps/unix/sysv/linux/fork.c (__libc_fork): Fix comment.
Diffstat (limited to 'nptl/tst-atfork1.c')
-rw-r--r-- | nptl/tst-atfork1.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/nptl/tst-atfork1.c b/nptl/tst-atfork1.c index 25bd3f2..b42ab42 100644 --- a/nptl/tst-atfork1.c +++ b/nptl/tst-atfork1.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -17,10 +17,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <errno.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <sys/wait.h> static int val; @@ -67,6 +69,7 @@ static int do_test (void) { pid_t pid; + int status = 0; if (pthread_atfork (prepare1, parent1, child1) != 0) { @@ -94,6 +97,12 @@ do_test (void) printf ("expected val=%d, got %d\n", 24, val); exit (1); } + + if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid) + { + puts ("waitpid failed"); + exit (1); + } } else { @@ -101,11 +110,11 @@ do_test (void) if (val != 80) { printf ("expected val=%d, got %d\n", 80, val); - exit (1); + exit (2); } } - return 0; + return status; } #define TEST_FUNCTION do_test () |