From: Andre Noll <maan@systemlinux.org>
Date: Fri, 16 Apr 2010 11:39:28 +0000 (+0200)
Subject: Invalidate create_pid if create process has died.
X-Git-Tag: v0.1.4~8
X-Git-Url: https://git.tue.mpg.de/?a=commitdiff_plain;h=b9a6fb9f7735a8a71d8704eb22a72c2f9f4973d5;p=dss.git

Invalidate create_pid if create process has died.

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.
---

diff --git a/dss.c b/dss.c
index da096aa..c45f450 100644
--- 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);