mis.bitmap_fd = -1;
mis.bitmap_file = NULL;
mis.name[0] = 0;
+ mis.container = NULL;
+ mis.member = NULL;
for (w=dl_next(line); w!=line; w=dl_next(w)) {
if (w[0] == '/') {
/* subarray within a container */
mis.member = strdup(w+7);
} else if (strncasecmp(w, "container=", 10) == 0) {
- /* the container holding this subarray */
+ /* the container holding this subarray. Either a device name
+ * or a uuid */
mis.container = strdup(w+10);
} else {
fprintf(stderr, Name ": unrecognised word on ARRAY line: %s\n",
w);
}
}
- if (mis.devname == NULL)
- fprintf(stderr, Name ": ARRAY line with no device\n");
- else if (mis.uuid_set == 0 && mis.devices == NULL && mis.super_minor == UnSet && mis.name[0] == 0)
+ if (mis.uuid_set == 0 && mis.devices == NULL && mis.super_minor == UnSet && mis.name[0] == 0)
fprintf(stderr, Name ": ARRAY line %s has no identity information.\n", mis.devname);
else {
mi = malloc(sizeof(*mi));
*mi = mis;
- mi->devname = strdup(mis.devname);
+ mi->devname = mis.devname ? strdup(mis.devname) : NULL;
mi->next = NULL;
*mddevlp = mi;
mddevlp = &mi->next;
if (alert_mail_from == NULL)
alert_mail_from = strdup(w);
else {
- char *t= NULL;
- asprintf(&t, "%s %s", alert_mail_from, w);
- free(alert_mail_from);
- alert_mail_from = t;
+ char *t = NULL;
+
+ if (asprintf(&t, "%s %s", alert_mail_from, w) > 0) {
+ free(alert_mail_from);
+ alert_mail_from = t;
+ }
}
}
}
mddev_ident_t rv;
load_conffile();
rv = mddevlist;
- while (dev && rv && strcmp(dev, rv->devname)!=0)
+ while (dev && rv && (rv->devname == NULL
+ || strcmp(dev, rv->devname)!=0))
rv = rv->next;
return rv;
}