summaryrefslogtreecommitdiff
path: root/miscutils/mountpoint.c
diff options
context:
space:
mode:
authorVladimir Dronnikov2009-11-01 04:33:23 +0100
committerDenys Vlasenko2009-11-01 04:33:23 +0100
commit4214f8b537045e88de14a721e6aa773fe36d771f (patch)
treed8f12ff663f3e618f917c68b27586a13a48687b0 /miscutils/mountpoint.c
parentfe4e23f9ded69194d525775b1ef7648461a7f76d (diff)
downloadbusybox-4214f8b537045e88de14a721e6aa773fe36d771f.zip
busybox-4214f8b537045e88de14a721e6aa773fe36d771f.tar.gz
mountpoint: btrfs fix
Signed-off-by: Vladimir Dronnikov <dronnikov@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils/mountpoint.c')
-rw-r--r--miscutils/mountpoint.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c
index b541ce2..a35c389 100644
--- a/miscutils/mountpoint.c
+++ b/miscutils/mountpoint.c
@@ -55,8 +55,17 @@ int mountpoint_main(int argc UNUSED_PARAM, char **argv)
if (opt & OPT_d)
printf("%u:%u\n", major(st_dev), minor(st_dev));
- if (opt & OPT_n)
- printf("%s %s\n", find_block_device(arg), arg);
+ if (opt & OPT_n) {
+ const char *d = find_block_device(arg);
+ /* name is undefined, but device is mounted -> anonymous superblock! */
+ /* happens with btrfs */
+ if (!d) {
+ d = "UNKNOWN";
+ /* TODO: iterate /proc/mounts, or /proc/self/mountinfo
+ * to find out the device name */
+ }
+ printf("%s %s\n", d, arg);
+ }
if (!(opt & (OPT_q | OPT_d | OPT_n)))
printf("%s is %sa mountpoint\n", arg, is_not_mnt ? "not " : "");
return is_not_mnt;