diff options
author | NeilBrown <neilb@suse.de> | 2008-11-04 20:50:38 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2008-11-04 20:50:38 +1100 |
commit | fe056d1fb0b1d08c614f574cceaa640abc382544 (patch) | |
tree | 2ee2ebca04e23a7dc912fdef7c4f7bd95066a17c /config.c | |
parent | 215bb3f77627d818d5bc3eaca190212d491e1fcf (diff) |
config: Don't require an array to have a device name.
i.e. in mdadm.conf you can have a line like
ARRAY uuid=whatever
and it will use auto-name-generation to give a name to the array at
assemble-time. The is different from blind auto-assembly in that the
array will be treated as 'local'.
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -529,14 +529,12 @@ void arrayline(char *line) 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 +719,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; } |