summaryrefslogtreecommitdiffabout
path: root/src/dudki.cc
Side-by-side diff
Diffstat (limited to 'src/dudki.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--src/dudki.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/dudki.cc b/src/dudki.cc
index 3c50e56..b769109 100644
--- a/src/dudki.cc
+++ b/src/dudki.cc
@@ -207,38 +207,43 @@ int main(int argc,char **argv) {
syslog(LOG_NOTICE,"The dudki process is down, taking its place");
config.daemonize = true;
}catch(int zero) {
// we throw zero in case we're ensuring that this very process is running.
// we don't have to daemonize if we're daemonic.
config.daemonize = false;
}
case op_default:
case op_work:
{
if(config.daemonize) {
pid_t pf = fork();
if(pf<0)
throw runtime_error(string(__PRETTY_FUNCTION__)+": failed to fork()");
if(pf) {
_exit(0);
}
}
pid_file pidfile;
pidfile.set(config.pidfile);
signal(SIGINT,lethal_signal_handler);
signal(SIGABRT,lethal_signal_handler);
signal(SIGTERM,lethal_signal_handler);
signal(SIGHUP,sighup_handler);
+ sigset_t sset;
+ sigemptyset(&sset);
+ sigaddset(&sset,SIGINT); sigaddset(&sset,SIGABRT);
+ sigaddset(&sset,SIGTERM); sigaddset(&sset,SIGHUP);
+ sigprocmask(SIG_UNBLOCK,&sset,NULL);
while(!finishing) {
check_herd(config);
sleep(config.check_interval);
}
}
break;
default:
throw runtime_error(string(__PRETTY_FUNCTION__)+": internal error");
}
}catch(exception& e) {
cerr << "Oops: " << e.what() << endl;
return 1;
}
}