]> git.tue.mpg.de Git - dss.git/commitdiff
run: Wait for children to die.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 16 Oct 2017 15:36:51 +0000 (17:36 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 2 Nov 2017 21:10:30 +0000 (22:10 +0100)
When the select loop returns and dss is about to terminate, it sends
SIGTERM to any running rm or rsync processes and exits. It does not
wait for these processes to die, however. This is trivial to implement,
and it makes life easier for shutdown scripts which like to proceed
with unmounting file systems.

dss.c

diff --git a/dss.c b/dss.c
index 3e626ab0113b1890277da115ea6c735dbdb690d7..e9bd56a5e883f3f9aa2ee0ef4bf463dce9f2c7ba 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -1565,6 +1565,8 @@ static int com_run(void)
                ret = -E_BUG;
        kill_children();
        exit_hook(ret);
+       while (wait(NULL) >= 0 || errno != ECHILD)
+               ; /* still have children to wait for */
        return ret;
 }
 EXPORT_CMD_HANDLER(run);