Ignore leading zeros in version number information.

--detail sometimes generates leading zero which are just noise.
This commit is contained in:
NeilBrown 2008-09-18 15:07:45 +10:00
parent 7b187ed7e9
commit 9b2a22d319
2 changed files with 12 additions and 3 deletions

View File

@ -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 ||

View File

@ -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;
}