From 9b2a22d319a85c1571c776e7059d9ca4bf1a0f0a Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 18 Sep 2008 15:07:45 +1000 Subject: [PATCH] Ignore leading zeros in version number information. --detail sometimes generates leading zero which are just noise. --- super0.c | 3 +++ super1.c | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/super0.c b/super0.c index 99aa3d8..4f58954 100644 --- 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 || diff --git a/super1.c b/super1.c index 2e3ef53..e71b969 100644 --- 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; }