]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
fix mdmon takeover
authorLuca Berra <bluca@comedia.it>
Sat, 27 Feb 2010 15:07:51 +0000 (16:07 +0100)
committerNeilBrown <neilb@suse.de>
Wed, 3 Mar 2010 00:35:26 +0000 (11:35 +1100)
- 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@comedia.it>
Signed-off-by: NeilBrown <neilb@suse.de>
msg.c
util.c

diff --git a/msg.c b/msg.c
index cc07b96510493e7250d00dc95b7f2e0e0618fd2e..d2d844589a1c565efe1b1686cced5e8d55395eee 100644 (file)
--- a/msg.c
+++ b/msg.c
@@ -147,7 +147,7 @@ int connect_monitor(char *devname)
        int pos;
        char *c;
 
        int pos;
        char *c;
 
-       pos = sprintf(path, "%s/", VAR_RUN);
+       pos = sprintf(path, "%s/", pid_dir);
        if (is_subarray(devname)) {
                devname++;
                c = strchr(devname, '/');
        if (is_subarray(devname)) {
                devname++;
                c = strchr(devname, '/');
diff --git a/util.c b/util.c
index 5d5711c897f37ee19fb2d530692e38081f508e55..66be82ab8082696931ee457003db5dc4d261f0b0 100644 (file)
--- 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)
        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)
        n = read(fd, pid, 9);
        close(fd);
        if (n <= 0)
-               return 0;
+               return -1;
        return atoi(pid);
 }
 
        return atoi(pid);
 }