summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorLuca Berra <bluca@comedia.it>2010-02-27 16:07:51 +0100
committerNeilBrown <neilb@suse.de>2010-03-03 11:35:26 +1100
commitcf556303573cd8cb9140c819b1ba1102ebc9cac7 (patch)
tree43d19c1aa1032df7a101244c2ac793a780ad18aa /util.c
parenteb49460b74f42e23bf284c4ccf92f4b6da2c582d (diff)
downloadmdadm-cf556303573cd8cb9140c819b1ba1102ebc9cac7.tar.gz
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@comedia.it> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'util.c')
-rw-r--r--util.c4
1 files changed, 2 insertions, 2 deletions
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);
}