]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - config.c
Always set 'homehost' if not specified.
[thirdparty/mdadm.git] / config.c
index 02ab3e00cadf43a3eed2ff429ac17ac4926b6933..9eb8197a9382a1b805f50adb3e8f2d6bc55266ec 100644 (file)
--- a/config.c
+++ b/config.c
@@ -522,21 +522,20 @@ void arrayline(char *line)
                        /* 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;
@@ -721,7 +720,8 @@ mddev_ident_t conf_get_ident(char *dev)
        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;
 }