diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-01-13 11:39:22 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-01-13 11:39:22 +0000 |
commit | fd3baeb88e11e17577fce29c95c228879c404524 (patch) | |
tree | 9a0ba9636cfe7c96b86d89fc6b6521ea1408985e /libbb | |
parent | f40d58e66d888b3cfbc9e53b676cd0134b563cf3 (diff) | |
download | busybox-w32-fd3baeb88e11e17577fce29c95c228879c404524.tar.gz busybox-w32-fd3baeb88e11e17577fce29c95c228879c404524.tar.bz2 busybox-w32-fd3baeb88e11e17577fce29c95c228879c404524.zip |
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
git-svn-id: svn://busybox.net/trunk/busybox@8279 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/find_root_device.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libbb/find_root_device.c b/libbb/find_root_device.c index c595321df..836ce44d5 100644 --- a/libbb/find_root_device.c +++ b/libbb/find_root_device.c | |||
@@ -38,8 +38,11 @@ extern char *find_real_root_device_name(const char* name) | |||
38 | if (stat("/", &rootStat) != 0) | 38 | if (stat("/", &rootStat) != 0) |
39 | bb_perror_msg("could not stat '/'"); | 39 | bb_perror_msg("could not stat '/'"); |
40 | else { | 40 | else { |
41 | if ((dev = rootStat.st_rdev)==0) | 41 | /* This check is here in case they pass in /dev name */ |
42 | dev=rootStat.st_dev; | 42 | if ((rootStat.st_mode & S_IFMT) == S_IFBLK) |
43 | dev = rootStat.st_rdev; | ||
44 | else | ||
45 | dev = rootStat.st_dev; | ||
43 | 46 | ||
44 | dir = opendir("/dev"); | 47 | dir = opendir("/dev"); |
45 | if (!dir) | 48 | if (!dir) |