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);
{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:
} 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;
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;