about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-15 06:06:02 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-15 06:06:02 +0000
commit8a3f5844c508a67f4fe291236ca7dd73b3d71699 (patch)
treed34a2134015623f0d7ee8da7166ddb7c0ea5f4de /nptl
parenta2f63c54dd20343ab3ac9cdce7897e0ecbb95e8d (diff)
downloadglibc-8a3f5844c508a67f4fe291236ca7dd73b3d71699.tar.gz
glibc-8a3f5844c508a67f4fe291236ca7dd73b3d71699.tar.xz
glibc-8a3f5844c508a67f4fe291236ca7dd73b3d71699.zip
If child crashes, report this first. Print which signal.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/tst-getpid1.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/nptl/tst-getpid1.c b/nptl/tst-getpid1.c
index 061b48d735..497bebed56 100644
--- a/nptl/tst-getpid1.c
+++ b/nptl/tst-getpid1.c
@@ -1,5 +1,6 @@
 #include <sched.h>
 #include <signal.h>
+#include <string.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <sys/types.h>
@@ -66,20 +67,6 @@ do_test (void)
       }
   while  (si.si_signo != sig || si.si_code != SI_QUEUE);
 
-  if (si.si_int != (int) p)
-    {
-      printf ("expected PID %d, got si_int %d\n", (int) p, si.si_int);
-      kill (p, SIGKILL);
-      return 1;
-    }
-
-  if (si.si_pid != p)
-    {
-      printf ("expected PID %d, got si_pid %d\n", (int) p, (int) si.si_pid);
-      kill (p, SIGKILL);
-      return 1;
-    }
-
   int e;
   if (waitpid (p, &e, __WCLONE) != p)
     {
@@ -89,7 +76,10 @@ do_test (void)
     }
   if (!WIFEXITED (e))
     {
-      puts ("did not terminate correctly");
+      if (WIFSIGNALED (e))
+	printf ("died from signal %s\n", strsignal (WTERMSIG (e)));
+      else
+	puts ("did not terminate correctly");
       return 1;
     }
   if (WEXITSTATUS (e) != 0)
@@ -98,6 +88,20 @@ do_test (void)
       return 1;
     }
 
+  if (si.si_int != (int) p)
+    {
+      printf ("expected PID %d, got si_int %d\n", (int) p, si.si_int);
+      kill (p, SIGKILL);
+      return 1;
+    }
+
+  if (si.si_pid != p)
+    {
+      printf ("expected PID %d, got si_pid %d\n", (int) p, (int) si.si_pid);
+      kill (p, SIGKILL);
+      return 1;
+    }
+
   if (getpid () != mypid)
     {
       puts ("my PID changed");