* winsup.api/resethand.c: Use SIGSEGV for the signal to test.

This commit is contained in:
Christopher Faylor 2006-01-01 18:02:54 +00:00
parent 031d1aa40f
commit 74c29a5e9a
2 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2006-01-01 Christopher Faylor <cgf@timesys.com>
* winsup.api/resethand.c: Use SIGSEGV for the signal to test.
2006-01-01 Christopher Faylor <cgf@timesys.com>
* winsup.api/resethand.c: New file.

View File

@ -9,7 +9,7 @@ void
ouch (int sig)
{
fprintf (stderr, "ouch %d\n", sig);
if (doit++ == 0)
if (doit++ > 0)
kill (getpid (), SIGTERM);
}
@ -20,16 +20,17 @@ main (int argc, char **argv)
if (argc == 1)
act.sa_flags = SA_RESETHAND;
act.sa_handler = ouch;
sigaction (SIGTERM, &act, NULL);
sigaction (SIGSEGV, &act, NULL);
int pid = fork ();
int status;
if (pid > 0)
waitpid (pid, &status, 0);
else
{
kill (getpid (), SIGTERM);
exit (0x27);
int *i = 0;
*i = 9;
exit (0x42);
}
fprintf (stderr, "pid %d exited with status %p\n", pid, status);
exit (argc == 1 ? !(status == SIGTERM) : !(status == 0x2700));
exit (argc == 1 ? !(status == SIGSEGV) : !(status == SIGTERM));
}