From d48f4d530eb492bd008318facff31bb725b066f5 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 19 Jan 1999 15:41:14 +0000 Subject: Update. * posix/test-vfork.c (main): Improve test to check for correct exit code. --- posix/test-vfork.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'posix/test-vfork.c') diff --git a/posix/test-vfork.c b/posix/test-vfork.c index 9c352897ed..959dcb3b01 100644 --- a/posix/test-vfork.c +++ b/posix/test-vfork.c @@ -6,10 +6,13 @@ void noop (void); +#define NR 2 /* Exit code of the child. */ + int main (void) { - int pid; + pid_t pid; + int status; printf ("Before vfork\n"); fflush (stdout); @@ -20,12 +23,14 @@ main (void) machines where it is stored on the stack, if vfork wasn't implemented correctly, */ noop (); - _exit (2); + _exit (NR); } else if (pid < 0) error (1, errno, "vfork"); printf ("After vfork (parent)\n"); - wait (0); + if (waitpid (0, &status, 0) != pid + || !WIFEXITED (status) || WEXITSTATUS (NR)) + exit (1); exit (0); } -- cgit 1.4.1