proper shutdown

moved signal handler for SIGCHD and SIGHUP to dumm
This commit is contained in:
Martin Willi
2007-08-03 11:47:20 +00:00
parent dfcdae0335
commit 5ce04046f7
5 changed files with 96 additions and 48 deletions
+2 -10
View File
@@ -401,14 +401,7 @@ static void list()
*/
void signal_action(int sig, siginfo_t *info, void *ucontext)
{
if (sig == SIGCHLD)
{
dumm->sigchild_handler(dumm, info);
}
else
{
printf("\nuse 'quit'\ndumm# ");
}
printf("\nuse 'quit'\ndumm# ");
}
/**
@@ -450,8 +443,7 @@ int main(int argc, char *argv[])
memset(&action, 0, sizeof(action));
action.sa_sigaction = signal_action;
action.sa_flags = SA_SIGINFO;
if (sigaction(SIGCHLD, &action, NULL) != 0 ||
sigaction(SIGINT, &action, NULL) != 0 ||
if (sigaction(SIGINT, &action, NULL) != 0 ||
sigaction(SIGQUIT, &action, NULL) != 0 ||
sigaction(SIGTERM, &action, NULL) != 0)
{