]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.c
Fix uninitialised variable compile warning.
[thirdparty/mdadm.git] / mdadm.c
diff --git a/mdadm.c b/mdadm.c
index 79f28860d2b636a60e5d21360527013a1e9eefb6..868a48b2959b3a7d7866979d7c400e2c0babf8a7 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -172,7 +172,7 @@ int main(int argc, char *argv[])
                                fprintf(stderr, "--%s", long_options[option_index].name);
                        else
                                fprintf(stderr, "-%c", opt);
-                       fprintf(stderr, " would set mode to %s, but it is already %s.\n",
+                       fprintf(stderr, " would set mdadm mode to \"%s\", but it is already set to \"%s\".\n",
                                map_num(modes, newmode),
                                map_num(modes, mode));
                        exit(2);
@@ -793,6 +793,16 @@ int main(int argc, char *argv[])
                                        /* apply to all devices in /proc/mdstat */
                                        struct mdstat_ent *ms = mdstat_read(0);
                                        struct mdstat_ent *e;
+                                       if (devmode == 'S') {
+                                               /* reverse order so that arrays made of arrays are stopped properly */
+                                               struct mdstat_ent *sm = NULL;
+                                               while ((e=ms) != NULL) {
+                                                       ms = e->next;
+                                                       e->next = sm;
+                                                       sm = e;
+                                               }
+                                               ms = sm;
+                                       }
                                        for (e=ms ; e ; e=e->next) {
                                                char *name = get_md_name(e->devnum);