aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mdev.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-02-13 00:02:54 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-02-13 00:02:54 +0000
commitd63cd1bf1cec62dcdfaf89e821b55c4d80421ba6 (patch)
tree4edb3227884b41e8dd279e2c978d6e85703ba5b0 /util-linux/mdev.c
parenta0ab943492c123690f41b751136e8c9cf261e195 (diff)
downloadbusybox-d63cd1bf1cec62dcdfaf89e821b55c4d80421ba6.tar.gz
mdev: if /sys/class/block exists, don't scan /sys/block
Diffstat (limited to 'util-linux/mdev.c')
-rw-r--r--util-linux/mdev.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 0460aa777..78bb48ac0 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -420,10 +420,17 @@ int mdev_main(int argc UNUSED_PARAM, char **argv)
* /sys/block/loop* (for example) are symlinks to dirs,
* not real directories.
* (kernel's CONFIG_SYSFS_DEPRECATED makes them real dirs,
- * but we can't enforce that on users) */
- recursive_action("/sys/block",
- ACTION_RECURSE | ACTION_FOLLOWLINKS | ACTION_QUIET,
- fileAction, dirAction, temp, 0);
+ * but we can't enforce that on users)
+ */
+ if (access("/sys/class/block", F_OK) != 0) {
+ /* Scan obsolete /sys/block only if /sys/class/block
+ * doesn't exist. Otherwise we'll have dupes.
+ */
+ recursive_action("/sys/block",
+ ACTION_RECURSE | ACTION_FOLLOWLINKS,
+ // not needed now? | ACTION_QUIET
+ fileAction, dirAction, temp, 0);
+ }
recursive_action("/sys/class",
ACTION_RECURSE | ACTION_FOLLOWLINKS,
fileAction, dirAction, temp, 0);