diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-12 10:28:41 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-12 10:28:41 +0000 |
commit | a87045ce37e01971bd40219293afdacd4c2317e2 (patch) | |
tree | e879605365aec335ad2572e25e5439aa1b4846f0 | |
parent | d9860487e0d88962c1f1ae25ee43bfd0c0b11ad5 (diff) | |
download | busybox-w32-a87045ce37e01971bd40219293afdacd4c2317e2.tar.gz busybox-w32-a87045ce37e01971bd40219293afdacd4c2317e2.tar.bz2 busybox-w32-a87045ce37e01971bd40219293afdacd4c2317e2.zip |
mdev: check for "/block/" substring for block dev detection
function old new delta
make_device 1294 1269 -25
-rw-r--r-- | util-linux/mdev.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 4ac5c430a..dd9522999 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c | |||
@@ -96,13 +96,11 @@ static void make_device(char *path, int delete) | |||
96 | /* Determine device name, type, major and minor */ | 96 | /* Determine device name, type, major and minor */ |
97 | device_name = bb_basename(path); | 97 | device_name = bb_basename(path); |
98 | /* http://kernel.org/doc/pending/hotplug.txt says that only | 98 | /* http://kernel.org/doc/pending/hotplug.txt says that only |
99 | * "/sys/block/..." is for block devices. "/sys/bus" etc is not! | 99 | * "/sys/block/..." is for block devices. "/sys/bus" etc is not. |
100 | * Since kernel 2.6.25 block devices are also in /sys/class/block. */ | 100 | * But since 2.6.25 block devices are also in /sys/class/block. |
101 | /* TODO: would it be acceptable to just use strstr(path, "/block/")? */ | 101 | * We use strstr("/block/") to forestall future surprises. */ |
102 | if (strncmp(&path[5], "class/block/"+6, 6) != 0 | 102 | type = S_IFCHR; |
103 | && strncmp(&path[5], "class/block/", 12) != 0) | 103 | if (strstr(path, "/block/")) |
104 | type = S_IFCHR; | ||
105 | else | ||
106 | type = S_IFBLK; | 104 | type = S_IFBLK; |
107 | 105 | ||
108 | if (ENABLE_FEATURE_MDEV_CONF) { | 106 | if (ENABLE_FEATURE_MDEV_CONF) { |