]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - util.c
Allow domain_test to report that no domains were found.
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index 38750b248892e5eef8dcc1e38e42521ba5a64553..81f936018ff4c6367a55822719ed3be0a6323a31 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1490,8 +1490,7 @@ int is_subarray_active(char *subarray, char *container)
 
        for (ent = mdstat; ent; ent = ent->next)
                if (is_container_member(ent, container))
-                       if (!subarray ||
-                           strcmp(to_subarray(ent, container), subarray) == 0)
+                       if (strcmp(to_subarray(ent, container), subarray) == 0)
                                break;
 
        free_mdstat(mdstat);
@@ -1499,11 +1498,6 @@ int is_subarray_active(char *subarray, char *container)
        return ent != NULL;
 }
 
-int is_container_active(char *container)
-{
-       return is_subarray_active(NULL, container);
-}
-
 /* open_subarray - opens a subarray in a container
  * @dev: container device name
  * @st: empty supertype
@@ -1962,7 +1956,7 @@ struct mdinfo *container_choose_spares(struct supertype *st,
                                if (spare_group)
                                        pol_add(&pol, pol_domain,
                                                spare_group, NULL);
-                               if (!domain_test(domlist, pol, metadata))
+                               if (domain_test(domlist, pol, metadata) != 1)
                                        found = 0;
                                dev_policy_free(pol);
                        }