]> git.tue.mpg.de Git - dss.git/commitdiff
Invalidate create_pid if create process has died.
authorAndre Noll <maan@systemlinux.org>
Fri, 16 Apr 2010 11:39:28 +0000 (13:39 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 16 Apr 2010 11:39:28 +0000 (13:39 +0200)
We're checking create_pid against zero at several places, for example before
sending a signal to the create process. So set create_pid is zero in
handle_sigchld() if the create process just died.

dss.c

diff --git a/dss.c b/dss.c
index da096aabede9f9bf26c2378cf2f5a57cd9086888..c45f4506ec210643d96b67cfc9d63967afa8593d 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -779,18 +779,22 @@ static int handle_sigchld(void)
        if (pid == create_pid) {
                switch (snapshot_creation_status) {
                case HS_PRE_RUNNING:
-                       return handle_pre_create_hook_exit(status);
+                       ret = handle_pre_create_hook_exit(status);
+                       break;
                case HS_RUNNING:
-                       return handle_rsync_exit(status);
+                       ret = handle_rsync_exit(status);
+                       break;
                case HS_POST_RUNNING:
                        snapshot_creation_status = HS_READY;
-                       return 1;
+                       ret = 1;
+                       break;
                default:
                        DSS_EMERG_LOG("BUG: create can't die in status %d\n",
                                snapshot_creation_status);
                        return -E_BUG;
                }
                create_pid = 0;
+               return ret;
        }
        if (pid == remove_pid) {
                ret = handle_remove_exit(status);