]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - gui.c
gui.c: Remove silly warning on SIGINT.
[paraslash.git] / gui.c
diff --git a/gui.c b/gui.c
index e85edba929780c440aa36915347bbb7fbca74911..dd7ffeb40b9fbaa6cc41350c1b0eb41a2317d0c1 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -518,6 +518,14 @@ __noreturn __printf_2_3 static void die(int exit_code, const char* fmt, ...)
 {
        va_list argp;
 
+       /* Kill every process in our process group. */
+       para_sigaction(SIGTERM, SIG_IGN);
+       kill(0, SIGTERM);
+       /* Wait up to two seconds for child processes to die. */
+       alarm(2);
+       while (waitpid(0, NULL, 0) >= 0)
+               ; /* nothing */
+       alarm(0);
        /* mousemask() exists only in ncurses */
 #ifdef NCURSES_MOUSE_VERSION
        mousemask(~(mmask_t)0, NULL); /* Avoid bad terminal state with xterm. */
@@ -526,9 +534,6 @@ __noreturn __printf_2_3 static void die(int exit_code, const char* fmt, ...)
        va_start(argp, fmt);
        vfprintf(stderr, fmt, argp);
        va_end(argp);
-       /* kill every process in the process group and exit */
-       para_sigaction(SIGTERM, SIG_IGN);
-       kill(0, SIGTERM);
        exit(exit_code);
 }
 
@@ -932,10 +937,6 @@ static int signal_post_select(struct sched *s, __a_unused void *context)
                die(EXIT_FAILURE, "only the good die young (caught SIGTERM)\n");
                return 1;
        case SIGINT:
-               PARA_WARNING_LOG("caught SIGINT, reset\n");
-               /* Nothing to do. SIGINT killed our child which gets noticed
-                * by do_select and resets everything.
-                */
                return 1;
        case SIGUSR1:
                PARA_NOTICE_LOG("got SIGUSR1, rereading configuration\n");