[PATCH] mdev: fix sysfs traversal with CONFIG_SYSFS_DEPRECATED_V2=y
Gregory Fong
gregory.0xf0 at gmail.com
Mon Sep 29 18:58:43 UTC 2014
From: Simon Edlund <simon at 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 at 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
More information about the busybox
mailing list