aboutsummaryrefslogtreecommitdiff
path: root/libbb/find_root_device.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-12-26 10:42:51 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-12-26 10:42:51 +0000
commitbf0a201008671f81c107de72c026b1b84967561d (patch)
treeaf74820b70fa27929fe218c95822c20651b60637 /libbb/find_root_device.c
parent5dd7ef0f37373e397a7160cb431a32ae57f9f7d9 (diff)
downloadbusybox-w32-bf0a201008671f81c107de72c026b1b84967561d.tar.gz
busybox-w32-bf0a201008671f81c107de72c026b1b84967561d.tar.bz2
busybox-w32-bf0a201008671f81c107de72c026b1b84967561d.zip
style fixes
last xcalloc replaced by xzalloc
Diffstat (limited to 'libbb/find_root_device.c')
-rw-r--r--libbb/find_root_device.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libbb/find_root_device.c b/libbb/find_root_device.c
index 71b79b8d0..1d74d1ea8 100644
--- a/libbb/find_root_device.c
+++ b/libbb/find_root_device.c
@@ -17,12 +17,13 @@ char *find_block_device(char *path)
17 dev_t dev; 17 dev_t dev;
18 char *retpath=NULL; 18 char *retpath=NULL;
19 19
20 if(stat(path, &st) || !(dir = opendir("/dev"))) return NULL; 20 if (stat(path, &st) || !(dir = opendir("/dev")))
21 return NULL;
21 dev = (st.st_mode & S_IFMT) == S_IFBLK ? st.st_rdev : st.st_dev; 22 dev = (st.st_mode & S_IFMT) == S_IFBLK ? st.st_rdev : st.st_dev;
22 while((entry = readdir(dir)) != NULL) { 23 while ((entry = readdir(dir)) != NULL) {
23 char devpath[PATH_MAX]; 24 char devpath[PATH_MAX];
24 sprintf(devpath,"/dev/%s", entry->d_name); 25 sprintf(devpath,"/dev/%s", entry->d_name);
25 if(!stat(devpath, &st) && S_ISBLK(st.st_mode) && st.st_rdev == dev) { 26 if (!stat(devpath, &st) && S_ISBLK(st.st_mode) && st.st_rdev == dev) {
26 retpath = xstrdup(devpath); 27 retpath = xstrdup(devpath);
27 break; 28 break;
28 } 29 }