From 4579e9c1c89d844615e800b6c23f7558c366154f Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 8 May 2008 21:49:28 +0000 Subject: mdev: /sys/class/block/ are also block devices function old new delta make_device 1200 1221 +21 --- util-linux/mdev.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'util-linux') diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 5e1cd36bb..4fff20dcd 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c @@ -70,8 +70,14 @@ static void make_device(char *path, int delete) /* Determine device name, type, major and minor */ device_name = bb_basename(path); /* 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); + * "/sys/block/..." is for block devices. "/sys/bus" etc is not! + * Since kernel 2.6.25 block devices are also in /sys/class/block. */ + /* TODO: would it be acceptable to just use strstr(path, "/block/")? */ + if (strncmp(&path[5], "class/block/"+6, 6) != 0 + && strncmp(&path[5], "class/block/", 12) != 0) + type = S_IFCHR; + else + type = S_IFBLK; if (ENABLE_FEATURE_MDEV_CONF) { FILE *fp; -- cgit v1.2.3