[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH] mdev: fix sysfs traversal with CONFIG_SYSFS_DEPRECATED_V2=y
From:       Gregory Fong <gregory.0xf0 () gmail ! com>
Date:       2014-09-29 18:58:43
Message-ID: 1412017123-20882-1-git-send-email-gregory.0xf0 () gmail ! com
[Download RAW message or body]

From: Simon Edlund <simon@edlund.nl>

When mdev -s traverses the /sys directory looking for "dev" files, it
starts with the block devices under /sys/block, and will find the "dev"
file through the symlink, and create a block device node.  In the next
stage it will scan the /sys/class looking for char devices, and will
find mtdX/dev again, but this time the mknod will fail because there is
already a device node with that name.

[gregory: added commit message to patch from BZ #6806]
Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
---
 util-linux/mdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index b2d5657..b65ed58 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -1049,6 +1049,9 @@ int mdev_main(int argc UNUSED_PARAM, char **argv)
 
 		putenv((char*)"ACTION=add");
 
+		recursive_action("/sys/class",
+			ACTION_RECURSE | ACTION_FOLLOWLINKS,
+			fileAction, dirAction, temp, 0);
 		/* ACTION_FOLLOWLINKS is needed since in newer kernels
 		 * /sys/block/loop* (for example) are symlinks to dirs,
 		 * not real directories.
@@ -1065,9 +1068,6 @@ int mdev_main(int argc UNUSED_PARAM, char **argv)
 				ACTION_RECURSE | ACTION_FOLLOWLINKS | ACTION_QUIET,
 				fileAction, dirAction, temp, 0);
 		}
-		recursive_action("/sys/class",
-			ACTION_RECURSE | ACTION_FOLLOWLINKS,
-			fileAction, dirAction, temp, 0);
 	} else {
 		char *fw;
 		char *seq;
-- 
1.9.1

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic