diff options
author | Justin Maggard <jmaggard10@gmail.com> | 2012-10-23 15:04:00 -0700 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-10-24 12:08:37 +1100 |
commit | a5d47a2bb5f765eb50383d50c2f28a6a870edcdc (patch) | |
tree | dfd5ea784114524d3ca1a69935ed089d9afe0be0 | |
parent | 22a6461775f3498555274efb2bc15470f93bd483 (diff) | |
download | mdadm-a5d47a2bb5f765eb50383d50c2f28a6a870edcdc.tar.gz |
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>
-rw-r--r-- | mdopen.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -210,7 +210,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') |