]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdmon: allow --takeover when original was started with --offroot
authorNeilBrown <neilb@suse.de>
Mon, 20 Aug 2012 00:37:21 +0000 (10:37 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 20 Aug 2012 00:37:21 +0000 (10:37 +1000)
As --offroot causes ARGV[0] to be changed, we need to be more
lenient when checking that the mdmon we are about to kill really
is mdmon.  i.e. allow name to be "@dmon" instead.

Signed-off-by: NeilBrown <neilb@suse.de>
mdmon.c

diff --git a/mdmon.c b/mdmon.c
index d06e4757deb3899e18d9c1b33603a44220f9877c..5d5ae94e372105f7f4a3c2879b87143b5b38c6df 100644 (file)
--- a/mdmon.c
+++ b/mdmon.c
@@ -184,7 +184,11 @@ static void try_kill_monitor(pid_t pid, char *devname, int sock)
        buf[sizeof(buf)-1] = 0;
        close(fd);
 
-       if (n < 0 || !strstr(buf, "mdmon"))
+       /* Note that if started with --offroot, the name
+        * might be "@dmon"
+        */
+       if (n < 0 || !(strstr(buf, "mdmon") ||
+                      strstr(buf, "@dmon")))
                return;
 
        kill(pid, SIGTERM);