[git commit] find_mount_point: fix find_mount_point for char devices

Denys Vlasenko vda.linux at googlemail.com
Wed Jan 18 00:49:11 UTC 2012


commit: http://git.busybox.net/busybox/commit/?id=ce4f39ac7c6c30e94f7ff392058928bd98347113
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

This allows to find mount points of 'char' devices such as UBI volumes
which otherwise fail for example with 'df' command:

/ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root             72091984  12360980  56068924  18% /
devtmpfs                115236         4    115232   0% /dev
tmpfs                    28672        32     28640   0% /tmp
/dev/ubi0_0             360268     18348    341920   5% /tmp/mnt/userfs

/ # df /dev/ubi0_0
Filesystem           1K-blocks      Used Available Use% Mounted on
devtmpfs                115236         4    115232   0% /dev

Signed-off-by: Javier Viguera <javier.viguera at digi.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 libbb/find_mount_point.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libbb/find_mount_point.c b/libbb/find_mount_point.c
index 56637ad..9676b5f 100644
--- a/libbb/find_mount_point.c
+++ b/libbb/find_mount_point.c
@@ -30,7 +30,8 @@ struct mntent* FAST_FUNC find_mount_point(const char *name, int subdir_too)
 
 	devno_of_name = s.st_dev;
 	block_dev = 0;
-	if (S_ISBLK(s.st_mode)) {
+	/* Why S_ISCHR? - UBI volumes use char devices, not block */
+	if (S_ISBLK(s.st_mode) || S_ISCHR(s.st_mode)) {
 		devno_of_name = s.st_rdev;
 		block_dev = 1;
 	}


More information about the busybox-cvs mailing list