]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - util.c
open_subarray: pass subarray name as explicit arg.
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index 27989636d4ab2318cbe423f2c027c8560a0cb567..b965c8d7883ddae9d8f7ec66a978fcf7374f59ed 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1441,12 +1441,12 @@ int is_container_active(char *container)
 
 /* open_subarray - opens a subarray in a container
  * @dev: container device name
- * @st: supertype with only ->subarray set
+ * @st: empty supertype
  * @quiet: block reporting errors flag
  *
  * On success returns an fd to a container and fills in *st
  */
-int open_subarray(char *dev, struct supertype *st, int quiet)
+int open_subarray(char *dev, char *subarray, struct supertype *st, int quiet)
 {
        struct mdinfo *mdi;
        int fd, err = 1;
@@ -1498,6 +1498,8 @@ int open_subarray(char *dev, struct supertype *st, int quiet)
                goto free_sysfs;
        }
 
+       strncpy(st->subarray, subarray, sizeof(st->subarray)-1);
+
        if (st->ss->load_super(st, fd, NULL)) {
                if (!quiet)
                        fprintf(stderr, Name ": Failed to find subarray-%s in %s\n",