]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.c
Assemble: allow members of containers to be assembled and auto-assembled.
[thirdparty/mdadm.git] / mdadm.c
diff --git a/mdadm.c b/mdadm.c
index f3086a92a8483484c7c02100c8cf537e7d9ecf7b..2bd963a58c2fbf9e3158b88bc2cb5938971ddd8b 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -256,6 +256,7 @@ int main(int argc, char *argv[])
                                        dv->writemostly = writemostly;
                                        dv->re_add = re_add;
                                        dv->used = 0;
+                                       dv->content = NULL;
                                        dv->next = NULL;
                                        *devlistend = dv;
                                        devlistend = &dv->next;
@@ -308,6 +309,8 @@ int main(int argc, char *argv[])
                        dv->disposition = devmode;
                        dv->writemostly = writemostly;
                        dv->re_add = re_add;
+                       dv->used = 0;
+                       dv->content = NULL;
                        dv->next = NULL;
                        *devlistend = dv;
                        devlistend = &dv->next;
@@ -997,7 +1000,7 @@ int main(int argc, char *argv[])
 
        if (homehost == NULL)
                homehost = conf_get_homehost();
-       if (homehost && strcmp(homehost, "<system>")==0) {
+       if (homehost == NULL || strcmp(homehost, "<system>")==0) {
                if (gethostname(sys_hostname, sizeof(sys_hostname)) == 0) {
                        sys_hostname[sizeof(sys_hostname)-1] = 0;
                        homehost = sys_hostname;
@@ -1082,16 +1085,6 @@ int main(int argc, char *argv[])
                                exit(1);
                        }
                        for (; array_list; array_list = array_list->next) {
-                               mdfd = open_mddev(array_list->devname, 0);
-                               if (mdfd >= 0) {
-                                       mdu_array_info_t array;
-                                       /* skip if already assembled */
-                                       if (ioctl(mdfd, GET_ARRAY_INFO, &array)>=0) {
-                                               cnt++;
-                                               close(mdfd);
-                                               continue;
-                                       }
-                               }
                                if (array_list->autof == 0)
                                        array_list->autof = autof;