From: Andre Noll Date: Tue, 14 Jan 2014 14:15:38 +0000 (+0100) Subject: Merge branch 't/exit_fix' X-Git-Tag: v0.1.5~1 X-Git-Url: http://git.tuebingen.mpg.de/?a=commitdiff_plain;h=641e3804cd87fb07b6089facd92f4452e5e3aa12;hp=f33cf243ae1cb5657cccb7c43c99093936093b4a;p=dss.git Merge branch 't/exit_fix' Was cooking since 2013-10. --- diff --git a/dss.c b/dss.c index 813d73d..3a2f468 100644 --- 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; }