qa: wait for child in newlib/200-signals

This commit is contained in:
Giacomo Tesio 2017-04-30 16:55:13 +02:00
parent 14934ee51f
commit bd22e5154c
1 changed files with 10 additions and 2 deletions

View File

@ -2,6 +2,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
void sighup(); /* routines child will call upon sigtrap */
void sigint();
@ -9,7 +10,7 @@ void sigquit();
int
main() {
int pid, p[2];
int pid, p[2], child, cstatus;
char dummy[1];
/* get child process */
@ -47,7 +48,14 @@ main() {
sleep(3); /* pause for 3 secs */
printf("\nPARENT: sending SIGQUIT\n\n");
kill(pid,SIGQUIT);
sleep(3);
child = wait(&cstatus);
if(child == pid && cstatus == 0)
exit(0);
else
{
printf("PARENT: child exited with status %d\n", cstatus);
exit(1);
}
}
}