From: NeilBrown Date: Mon, 20 Aug 2012 00:37:21 +0000 (+1000) Subject: mdmon: allow --takeover when original was started with --offroot X-Git-Tag: mdadm-3.3-rc1~232 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a99d3469713138f050cccb8657c24a05ffa7057e;p=thirdparty%2Fmdadm.git mdmon: allow --takeover when original was started with --offroot 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 --- diff --git a/mdmon.c b/mdmon.c index d06e4757..5d5ae94e 100644 --- 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);