NeilBrown: mdopen: only use 'dev' as chosen name if it is a full path.

Martin F. Krafft madduck at alioth.debian.org
Tue Oct 27 19:22:00 UTC 2009


Module: mdadm
Branch: upstream
Commit: 5ac6db12f9f970f26b7017517789bac200631b11
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=5ac6db12f9f970f26b7017517789bac200631b11

Author: NeilBrown <neilb at suse.de>
Date:   Mon Oct 19 17:11:15 2009 +1100

mdopen: only use 'dev' as chosen name if it is a full path.

Otherwise using names like "r0" causes problem.  They are
handled sufficiently by other paths in the code.

Signed-off-by: NeilBrown <neilb at suse.de>

---

 mdopen.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/mdopen.c b/mdopen.c
index d322cf4..ed53d6f 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -156,7 +156,6 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
 
 
 	if (dev) {
-		
 		if (strncmp(dev, "/dev/md/", 8) == 0) {
 			strcpy(cname, dev+8);
 		} else if (strncmp(dev, "/dev/", 5) == 0) {
@@ -307,7 +306,7 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
 		}
 	}
 
-	if (dev)
+	if (dev && dev[0] == '/')
 		strcpy(chosen, dev);
 	else if (cname[0] == 0)
 		strcpy(chosen, devname);




More information about the pkg-mdadm-commits mailing list