]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdopen: be more careful when adding digit to names.
authorNeilBrown <neilb@suse.de>
Tue, 10 Mar 2009 05:28:22 +0000 (16:28 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 10 Mar 2009 05:28:22 +0000 (16:28 +1100)
If we need to add digits to a name to make it unique, but don't have
to add '_', we need to avoid adding a digit immediately after a digit.
So if the last character of the name is a digit, add the '_' anyway.

Signed-off-by: NeilBrown <neilb@suse.de>
mdopen.c

index b4d7bdc0ee263324030fc222d74685247cf7aec2..5d478f5b5fdbcdb74f5572ff11788b6d6c521682 100644 (file)
--- a/mdopen.c
+++ b/mdopen.c
@@ -291,7 +291,7 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
                }
                cnlen = strlen(cname);
                while (conflict) {
-                       if (trustworthy == METADATA)
+                       if (trustworthy == METADATA && !isdigit(cname[cnlen-1]))
                                sprintf(cname+cnlen, "%d", unum);
                        else
                                /* add _%d to FOREIGN array that don't