mdev : bug corrected (patch attached)

Souf souf_oued at yahoo.fr
Fri Jun 1 17:13:26 UTC 2007


Le vendredi 01 juin 2007 à 15:15 +0200, Renaud Cerrato a écrit :
> Dear,
> 
> Using mdev, we noticed that some devices were not attached to /dev/
> using "mdev -s".
> Looking at the source code, the function which walk through the /sys/
> tree make use of lstat, but the /sys tree can use symlink as seen
> here : 
> 
> $ ls -l /sys/class/misc/
> lrwxrwxrwx    1 root     root            0 Jan  1  1970 watchdog
> -> ../../devices/platform/at91sam9x_wdt/watchdog
> 
> Doing so, the function can't walk through symbolic links. By replacing
> lstat by stat, the problem is corrected.   
> To avoid infinite loop, we added a walking through depth limit to 2
> (see udevstart.c).
> 
> Cheers

I had already sent a large patch to improve mdev but it does not seem to
interest many people, in any case I resend it here, it uses:

xmalloc_getline()
last_char_is()
recursive_action()
bb_make_directory()
remove_file()
bb_get_last_path_component()
xmalloc_readlink_or_warn()
xmalloc_readlink_or_warn()

all that for only 5.9 KB

RFC:
http://busybox.net/lists/busybox/2007-May/027367.html
http://busybox.net/lists/busybox/2007-May/027515.html

Malek.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mdev.patch
Type: text/x-patch
Size: 10977 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070601/46871797/attachment-0002.bin 


More information about the busybox mailing list