diff options
author | Denis Vlasenko | 2008-03-29 16:07:46 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-03-29 16:07:46 +0000 |
commit | aa8a601084f7f0fc74fc561e12b42f8d7e3a6fe9 (patch) | |
tree | 49986b140b1766e52c1a22c4d4ae226b619a7f6f | |
parent | 02f12f53e8d7fa92dbf4e7c9c5cb011e7922d74c (diff) | |
download | busybox-aa8a601084f7f0fc74fc561e12b42f8d7e3a6fe9.zip busybox-aa8a601084f7f0fc74fc561e12b42f8d7e3a6fe9.tar.gz |
mdev: fix block/char device detection. Closes bug 2144.
-rw-r--r-- | util-linux/mdev.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c index c4c4350..c8d603b 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c @@ -69,7 +69,9 @@ static void make_device(char *path, int delete) /* Determine device name, type, major and minor */ device_name = bb_basename(path); - type = (path[5] == 'c' ? S_IFCHR : S_IFBLK); /* "/sys/[c]lass"? */ + /* http://kernel.org/doc/pending/hotplug.txt says that only + * "/sys/block/..." is for block devices. "sys/bus" etc is not! */ + type = (strncmp(&path[5], "block/", 6) == 0 ? S_IFBLK : S_IFCHR); if (ENABLE_FEATURE_MDEV_CONF) { FILE *fp; |