From 16d898c7a76e076c4002fd5661fbdac1642d1f8a Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 8 Aug 2014 17:21:52 +1000 Subject: [PATCH] Don't handle keyboard based signals by children processes --- src/ckpool.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ckpool.c b/src/ckpool.c index 29311b6a..3c5529a1 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -783,13 +783,15 @@ static void rm_namepid(proc_instance_t *pi) * parent process to shut down cleanly. */ static void childsighandler(int sig) { - pid_t ppid = getppid(); - signal(sig, SIG_IGN); signal(SIGTERM, SIG_IGN); - LOGWARNING("Child process received signal %d, forwarding signal to %s main process", - sig, global_ckp->name); - kill_pid(ppid, sig); + if (sig != SIGUSR1) { + pid_t ppid = getppid(); + + LOGWARNING("Child process received signal %d, forwarding signal to %s main process", + sig, global_ckp->name); + kill_pid(ppid, sig); + } exit(0); } @@ -820,11 +822,9 @@ static void launch_process(proc_instance_t *pi) handler.sa_flags = 0; sigemptyset(&handler.sa_mask); sigaction(SIGTERM, &handler, NULL); - sigaction(SIGINT, &handler, NULL); + signal(SIGINT, SIG_IGN); + signal(SIGQUIT, SIG_IGN); - /* Detach child processes leaving main only to communicate with - * the terminal. */ - ioctl(0, TIOCNOTTY, NULL); rename_proc(pi->processname); write_namepid(pi); ret = pi->process(pi); @@ -917,7 +917,7 @@ static void sighandler(int sig) ckp->name, sig); cancel_join_pthread(&ckp->pth_watchdog); - __shutdown_children(ckp, SIGTERM); + __shutdown_children(ckp, SIGUSR1); /* Wait a second, then send SIGKILL */ sleep(1); __shutdown_children(ckp, SIGKILL);