]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdmon.c
platform-intel - cache 'intel_devices' for a few seconds.
[thirdparty/mdadm.git] / mdmon.c
diff --git a/mdmon.c b/mdmon.c
index 209347615811e0a3fc249d1f4446ed533f0c0513..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);
@@ -299,14 +303,13 @@ int main(int argc, char *argv[])
                {NULL, 0, NULL, 0}
        };
 
-       while ((opt = getopt_long(argc, argv, "th", options, NULL)) != -1) {
+       while ((opt = getopt_long(argc, argv, "tha", options, NULL)) != -1) {
                switch (opt) {
                case 'a':
                        container_name = argv[optind-1];
                        all = 1;
                        break;
                case 't':
-                       container_name = optarg;
                        takeover = 1;
                        break;
                case OffRootOpt:
@@ -435,7 +438,7 @@ static int mdmon(char *devname, int devnum, int must_fork, int takeover)
        } else
                pfd[0] = pfd[1] = -1;
 
-       container = calloc(1, sizeof(*container));
+       container = xcalloc(1, sizeof(*container));
        container->devnum = devnum;
        container->devname = devname;
        container->arrays = NULL;
@@ -474,7 +477,7 @@ static int mdmon(char *devname, int devnum, int must_fork, int takeover)
 
        container->devs = NULL;
        for (di = mdi->devs; di; di = di->next) {
-               struct mdinfo *cd = malloc(sizeof(*cd));
+               struct mdinfo *cd = xmalloc(sizeof(*cd));
                *cd = *di;
                cd->next = container->devs;
                container->devs = cd;