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
This commit is contained in:
parent
7c87b67c08
commit
1cda715bbc
@ -38,7 +38,10 @@ extern char *find_real_root_device_name(const char* name)
|
|||||||
if (stat("/", &rootStat) != 0)
|
if (stat("/", &rootStat) != 0)
|
||||||
bb_perror_msg("could not stat '/'");
|
bb_perror_msg("could not stat '/'");
|
||||||
else {
|
else {
|
||||||
if ((dev = rootStat.st_rdev)==0)
|
/* 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;
|
dev = rootStat.st_dev;
|
||||||
|
|
||||||
dir = opendir("/dev");
|
dir = opendir("/dev");
|
||||||
|
Loading…
Reference in New Issue
Block a user