[BusyBox-cvs] busybox/libbb find_root_device.c,1.10,1.11
Erik Andersen
andersen at busybox.net
Tue Jan 13 11:39:25 UTC 2004
Update of /var/cvs/busybox/libbb
In directory nail:/tmp/cvs-serv14114/libbb
Modified Files:
find_root_device.c
Log Message:
Fix a bug where mount could check the wrong device. st_rdev is the correct
device ID iff the named file is a character or block special device. Otherwise
it is meaningless junk, in which case st_dev should be used. This was done
incorrectly, which could cause mount to display bogus mount info.
-Erik
Index: find_root_device.c
===================================================================
RCS file: /var/cvs/busybox/libbb/find_root_device.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- find_root_device.c 14 Jul 2003 21:20:55 -0000 1.10
+++ find_root_device.c 13 Jan 2004 11:39:22 -0000 1.11
@@ -38,8 +38,11 @@
if (stat("/", &rootStat) != 0)
bb_perror_msg("could not stat '/'");
else {
- if ((dev = rootStat.st_rdev)==0)
- dev=rootStat.st_dev;
+ /* This check is here in case they pass in /dev name */
+ if ((rootStat.st_mode & S_IFMT) == S_IFBLK)
+ dev = rootStat.st_rdev;
+ else
+ dev = rootStat.st_dev;
dir = opendir("/dev");
if (!dir)
More information about the busybox-cvs
mailing list