]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Assemble.c
Allow domain_test to report that no domains were found.
[thirdparty/mdadm.git] / Assemble.c
index 36fd4b7afb25a5fc344d54bbcaf4f8d7069203f1..b3f54ce43a811b28f425bf1f92b9cb96361af19e 100644 (file)
@@ -379,7 +379,7 @@ int Assemble(struct supertype *st, char *mddev,
                }
                if (dfd >= 0) close(dfd);
                if (tmpdev->used == 2) {
-                       if (auto_assem)
+                       if (auto_assem || !inargv)
                                /* Ignore unrecognised devices during auto-assembly */
                                goto loop;
                        if (ident->uuid_set || ident->name[0] ||
@@ -597,7 +597,7 @@ int Assemble(struct supertype *st, char *mddev,
                } else {
                        struct dev_policy *pol = NULL;
                        pol = devnum_policy(stb.st_rdev);
-                       if (domain_test(domains, pol, NULL))
+                       if (domain_test(domains, pol, NULL) == 1)
                                /* take this spare if domains match */
                                tmpdev->used = 1;
                        else
@@ -1304,6 +1304,7 @@ int Assemble(struct supertype *st, char *mddev,
                                                content->array.raid_disks);
                                fprintf(stderr, "\n");
                        }
+                       st->ss->free_super(st);
                        sysfs_uevent(content, "change");
                        wait_for(chosen_name, mdfd);
                        close(mdfd);