svn commit: trunk/busybox/util-linux

vda at busybox.net vda at busybox.net
Sat Mar 29 16:07:46 UTC 2008


Author: vda
Date: 2008-03-29 09:07:46 -0700 (Sat, 29 Mar 2008)
New Revision: 21557

Log:
mdev: fix block/char device detection. Closes bug 2144.



Modified:
   trunk/busybox/util-linux/mdev.c


Changeset:
Modified: trunk/busybox/util-linux/mdev.c
===================================================================
--- trunk/busybox/util-linux/mdev.c	2008-03-29 16:00:52 UTC (rev 21556)
+++ trunk/busybox/util-linux/mdev.c	2008-03-29 16:07:46 UTC (rev 21557)
@@ -69,7 +69,9 @@
 
 	/* 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;




More information about the busybox-cvs mailing list