Luca Berra: fix mdmon takeover

Martin F. Krafft madduck at alioth.debian.org
Mon May 24 09:21:07 UTC 2010


Module: mdadm
Branch: upstream
Commit: cf556303573cd8cb9140c819b1ba1102ebc9cac7
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=cf556303573cd8cb9140c819b1ba1102ebc9cac7

Author: Luca Berra <bluca at comedia.it>
Date:   Sat Feb 27 16:07:51 2010 +0100

fix mdmon takeover

- when we waited for the old mdmon to exit, we didn't look
  for the socket in the right place

- when we failed to find a pid file, we returned the wrong
  value (code expected <0, but got ==0).

Signed-off-by: Luca Berra <bluca at comedia.it>
Signed-off-by: NeilBrown <neilb at suse.de>

---

 msg.c  |    2 +-
 util.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/msg.c b/msg.c
index cc07b96..d2d8445 100644
--- a/msg.c
+++ b/msg.c
@@ -147,7 +147,7 @@ int connect_monitor(char *devname)
 	int pos;
 	char *c;
 
-	pos = sprintf(path, "%s/", VAR_RUN);
+	pos = sprintf(path, "%s/", pid_dir);
 	if (is_subarray(devname)) {
 		devname++;
 		c = strchr(devname, '/');
diff --git a/util.c b/util.c
index 5d5711c..66be82a 100644
--- a/util.c
+++ b/util.c
@@ -1478,11 +1478,11 @@ int mdmon_pid(int devnum)
 	fd = open(path, O_RDONLY | O_NOATIME, 0);
 
 	if (fd < 0)
-		return 0;
+		return -1;
 	n = read(fd, pid, 9);
 	close(fd);
 	if (n <= 0)
-		return 0;
+		return -1;
 	return atoi(pid);
 }
 




More information about the pkg-mdadm-commits mailing list