summaryrefslogtreecommitdiffstats
path: root/mdopen.c
diff options
context:
space:
mode:
authorJustin Maggard <jmaggard10@gmail.com>2012-10-24 00:04:00 +0200
committerNeilBrown <neilb@suse.de>2012-10-24 03:07:32 +0200
commit4cda8682c6607d8268072243d310919bcc5f21b2 (patch)
treeefdf252f5604863bae03a89caab337034a9631f1 /mdopen.c
parentIncremental: support replacement devices. (diff)
downloadmdadm-4cda8682c6607d8268072243d310919bcc5f21b2.tar.xz
mdadm-4cda8682c6607d8268072243d310919bcc5f21b2.zip
Create new md devices consistently
Creating a new MD device with the name 'd-0' results in some unexpected behavior, since mdadm sees that '-0' is a non-negative integer and therefore makes a "partitionable" device (/dev/md_d0). This is not the expected behavior, since the documentation mentions 'dN' several places, and a reboot brings it up as /dev/md/d-0. Make this consistent by ensuring that the character immediately following 'd' is a digit during creation. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdopen.c')
-rw-r--r--mdopen.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mdopen.c b/mdopen.c
index 61eda812..24188df6 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -207,7 +207,10 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
char *ep;
if (cname[0] == 'd')
sp++;
- num = strtoul(sp, &ep, 10);
+ if (isdigit(sp[0]))
+ num = strtoul(sp, &ep, 10);
+ else
+ ep = sp;
if (ep == sp || *ep || num < 0)
num = -1;
else if (cname[0] == 'd')