]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Ignore leading zeros in version number information.
authorNeilBrown <neilb@suse.de>
Thu, 18 Sep 2008 05:07:45 +0000 (15:07 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 18 Sep 2008 05:07:45 +0000 (15:07 +1000)
--detail sometimes generates leading zero which are just noise.

super0.c
super1.c

index 99aa3d885be595f507ea130f5aa9f7890264b9b7..4f58954e45daec0e730a8b1d951d6353e278b8f5 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -893,6 +893,9 @@ static struct supertype *match_metadata_desc0(char *arg)
        st->minor_version = 90;
        st->max_devs = MD_SB_DISKS;
        st->sb = NULL;
+       /* we sometimes get 00.90 */
+       while (arg[0] == '0' && arg[1] == '0')
+               arg++;
        if (strcmp(arg, "0") == 0 ||
            strcmp(arg, "0.90") == 0 ||
            strcmp(arg, "default") == 0 ||
index 2e3ef530106f5883ef7733ec31e6f13e4f090c3b..e71b96961d9a4c0b46a8820de48b0f1fe04a7f01 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -1232,15 +1232,21 @@ static struct supertype *match_metadata_desc1(char *arg)
        st->ss = &super1;
        st->max_devs = 384;
        st->sb = NULL;
-       if (strcmp(arg, "1.0") == 0) {
+       /* leading zeros can be safely ignored.  --detail generates them. */
+       while (*arg == '0')
+               arg++;
+       if (strcmp(arg, "1.0") == 0 ||
+           strcmp(arg, "1.00") == 0) {
                st->minor_version = 0;
                return st;
        }
-       if (strcmp(arg, "1.1") == 0) {
+       if (strcmp(arg, "1.1") == 0 ||
+           strcmp(arg, "1.01") == 0) {
                st->minor_version = 1;
                return st;
        }
-       if (strcmp(arg, "1.2") == 0) {
+       if (strcmp(arg, "1.2") == 0 ||
+           strcmp(arg, "1.02") == 0) {
                st->minor_version = 2;
                return st;
        }