]> git.tuebingen.mpg.de Git - dss.git/commitdiff
Merge branch 't/exit_fix'
authorAndre Noll <maan@systemlinux.org>
Tue, 14 Jan 2014 14:15:38 +0000 (15:15 +0100)
committerAndre Noll <maan@systemlinux.org>
Tue, 14 Jan 2014 14:16:19 +0000 (15:16 +0100)
Was cooking since 2013-10.

dss.c

diff --git a/dss.c b/dss.c
index 813d73dc11204a2a4a6989c89e23f469db049680..3a2f46886c310f23b987665854c99e75334e44b0 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -1038,6 +1038,13 @@ static int handle_sighup(void)
        return change_to_dest_dir();
 }
 
+static void kill_children(void)
+{
+       restart_create_process();
+       dss_kill(create_pid, SIGTERM, NULL);
+       dss_kill(remove_pid, SIGTERM, NULL);
+}
+
 static int handle_signal(void)
 {
        int sig, ret = next_signal();
@@ -1048,9 +1055,7 @@ static int handle_signal(void)
        switch (sig) {
        case SIGINT:
        case SIGTERM:
-               restart_create_process();
-               dss_kill(create_pid, SIGTERM, NULL);
-               dss_kill(remove_pid, SIGTERM, NULL);
+               kill_children();
                ret = -E_SIGNAL;
                break;
        case SIGHUP:
@@ -1319,6 +1324,7 @@ static int com_run(void)
        ret = select_loop();
        if (ret >= 0) /* impossible */
                ret = -E_BUG;
+       kill_children();
        exit_hook(ret);
        return ret;
 }
@@ -1442,7 +1448,7 @@ static int com_ls(void)
                if (s->flags & SS_COMPLETE)
                        d = (s->completion_time - s->creation_time) / 60;
                dss_msg("%u\t%s\t%3" PRId64 ":%02" PRId64 "\n", s->interval, s->name, d/60, d%60);
-       };
+       }
        free_snapshot_list(&sl);
        return 1;
 }