aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbb/find_root_device.c7
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)