* winsup.api/resethand.c: Use SIGSEGV for the signal to test.
This commit is contained in:
parent
031d1aa40f
commit
74c29a5e9a
|
@ -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>
|
2006-01-01 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* winsup.api/resethand.c: New file.
|
* winsup.api/resethand.c: New file.
|
||||||
|
|
|
@ -9,7 +9,7 @@ void
|
||||||
ouch (int sig)
|
ouch (int sig)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "ouch %d\n", sig);
|
fprintf (stderr, "ouch %d\n", sig);
|
||||||
if (doit++ == 0)
|
if (doit++ > 0)
|
||||||
kill (getpid (), SIGTERM);
|
kill (getpid (), SIGTERM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,16 +20,17 @@ main (int argc, char **argv)
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
act.sa_flags = SA_RESETHAND;
|
act.sa_flags = SA_RESETHAND;
|
||||||
act.sa_handler = ouch;
|
act.sa_handler = ouch;
|
||||||
sigaction (SIGTERM, &act, NULL);
|
sigaction (SIGSEGV, &act, NULL);
|
||||||
int pid = fork ();
|
int pid = fork ();
|
||||||
int status;
|
int status;
|
||||||
if (pid > 0)
|
if (pid > 0)
|
||||||
waitpid (pid, &status, 0);
|
waitpid (pid, &status, 0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
kill (getpid (), SIGTERM);
|
int *i = 0;
|
||||||
exit (0x27);
|
*i = 9;
|
||||||
|
exit (0x42);
|
||||||
}
|
}
|
||||||
fprintf (stderr, "pid %d exited with status %p\n", pid, status);
|
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));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue