]> jfr.im git - solanum.git/blobdiff - src/ircd_signal.c
If use_forward is off, ignore forwarding bans rather than stripping the channel.
[solanum.git] / src / ircd_signal.c
index 0a02c0958c1227d22ddaf7c4c24843a5598cff80..079b078ce81cd97fb4300d2e76ecfaab8c386261 100644 (file)
@@ -57,12 +57,7 @@ sigchld_handler(int sig)
 static void
 sigterm_handler(int sig)
 {
-       /* XXX we had a flush_connections() here - we should close all the
-        * connections and flush data. read server_reboot() for my explanation.
-        *     -- adrian
-        */
-       ilog(L_MAIN, "Server killed By SIGTERM");
-       exit(-1);
+       ircd_shutdown("Received SIGTERM");
 }
 
 /* 
@@ -119,8 +114,10 @@ sigint_handler(int sig)
 void
 setup_signals()
 {
+       sigset_t sigs;
        struct sigaction act;
 
+       sigemptyset(&sigs);
        act.sa_flags = 0;
        act.sa_handler = SIG_IGN;
        sigemptyset(&act.sa_mask);
@@ -141,30 +138,38 @@ setup_signals()
 
        act.sa_handler = dummy_handler;
        sigaction(SIGALRM, &act, 0);
+       sigaddset(&sigs, SIGALRM);
 
        act.sa_handler = sighup_handler;
        sigemptyset(&act.sa_mask);
        sigaddset(&act.sa_mask, SIGHUP);
        sigaction(SIGHUP, &act, 0);
+       sigaddset(&sigs, SIGHUP);
 
        act.sa_handler = sigint_handler;
        sigaddset(&act.sa_mask, SIGINT);
        sigaction(SIGINT, &act, 0);
+       sigaddset(&sigs, SIGINT);
 
        act.sa_handler = sigterm_handler;
        sigaddset(&act.sa_mask, SIGTERM);
        sigaction(SIGTERM, &act, 0);
+       sigaddset(&sigs, SIGTERM);
 
        act.sa_handler = sigusr1_handler;
        sigaddset(&act.sa_mask, SIGUSR1);
        sigaction(SIGUSR1, &act, 0);
+       sigaddset(&sigs, SIGUSR1);
 
        act.sa_handler = sigusr2_handler;
        sigaddset(&act.sa_mask, SIGUSR2);
        sigaction(SIGUSR2, &act, 0);
+       sigaddset(&sigs, SIGUSR2);
 
        act.sa_handler = sigchld_handler;
        sigaddset(&act.sa_mask, SIGCHLD);
        sigaction(SIGCHLD, &act, 0);
+       sigaddset(&sigs, SIGCHLD);
 
+       sigprocmask(SIG_UNBLOCK, &sigs, NULL);
 }