On Wed, Jul 15, 2015 at 11:10 PM, Gregory Fong <[email protected]> wrote:
> From: Simon Edlund <[email protected]>
>
> 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.

By swapping  recursive_action("/sys/class") and
recursive_action("/sys/block"), now the same thing will happen
when the second scan is done.

Why this is better?

> [gregory: added commit message to patch from BZ #6806]
> Signed-off-by: Gregory Fong <[email protected]>
> ---
>  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 ca4b915..4495b0a 100644
> --- a/util-linux/mdev.c
> +++ b/util-linux/mdev.c
> @@ -1063,6 +1063,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.
> @@ -1079,9 +1082,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
> [email protected]
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to