[BusyBox] [BUG & PATCH]in find_real_root_device_name

Tito farmatito at tiscali.it
Wed Jul 28 02:54:18 UTC 2004


On Tuesday 27 July 2004 OO:44, Tito wrote:
> Hi ,
> by looking further in find_real_root_device_name() function in libbb
> i've found something that seems a bug to me.
> If parsing a /dev directory that contains an entry named root
> (in my case a symbolic link to  ide/host0/bus0/target1/lun0/part1 )
> the function returns /dev/root rather than /dev/hdb1.
> A fix could be:
> ------------------------------------------------------------------------------------
> --- find_root_device.c.orig     2004-03-15 08:28:42.000000000 +0000
> +++ find_root_device.c  2004-07-27 22:36:58.558314064 +0000
> @@ -54,7 +54,9 @@
>                                  * would get a false positive on ".."  */
>                                 if (myname[0] == '.' && myname[1] == '.' && !myname[2])
>                                         continue;
> -
> +                               if (strcmp(myname,"root")==0)
> +                                       continue;
> +
>                                 fileName = concat_path_file("/dev", myname);
> 
>                                 /* Some char devices have the same dev_t as block
> 
> ---------------------------------------------------------------------------------------
> I've tested this with bb's df and on my box it works .
> Ciao,
> Tito
> 
Just one more idea about this, maybe we could also do a
continue if myname is a link rather than do strcmp(myname,"root")
as the root device is the file the link points to.

A late night thought after a couple of beers.
Tito



More information about the busybox mailing list