From: Dan Williams Date: Tue, 25 Jan 2011 02:54:06 +0000 (-0800) Subject: fix extended partition detection X-Git-Tag: mdadm-3.1.5~46 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fmdadm.git;a=commitdiff_plain;h=f58dd437412348b77bc09b79c656cf3472e9913d fix extended partition detection # mdadm --detail --export /dev/md127p1 Before: MD_LEVEL=raid5 MD_DEVICES=4 MD_METADATA=0.90 After: MD_LEVEL=raid5 MD_DEVICES=4 MD_CONTAINER=/dev/md0 MD_MEMBER=0 MD_UUID=55746a20:925d24a7:4f9bd7e2:9c9a411f We parse the symlink target with a format: ../../block/mdXXX/mdXXXpYY ...and need the second '/' from the end of the string to read detect a 'md' device. Reported-by: Krzysztof Wasilewski Cc: Przemyslaw Czarnowski Signed-off-by: Dan Williams Signed-off-by: NeilBrown --- diff --git a/util.c b/util.c index c9bdd6eb..75a5e6df 100644 --- a/util.c +++ b/util.c @@ -1664,7 +1664,7 @@ int stat2devnum(struct stat *st) link[n] = 0; cp = strrchr(link, '/'); if (cp) *cp = 0; - cp = strchr(link, '/'); + cp = strrchr(link, '/'); if (cp && strncmp(cp, "/md", 3) == 0) return devname2devnum(cp+1); }