aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/mountpoint.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c
index b541ce28c..a35c38907 100644
--- a/miscutils/mountpoint.c
+++ b/miscutils/mountpoint.c
@@ -55,8 +55,17 @@ int mountpoint_main(int argc UNUSED_PARAM, char **argv)
55 55
56 if (opt & OPT_d) 56 if (opt & OPT_d)
57 printf("%u:%u\n", major(st_dev), minor(st_dev)); 57 printf("%u:%u\n", major(st_dev), minor(st_dev));
58 if (opt & OPT_n) 58 if (opt & OPT_n) {
59 printf("%s %s\n", find_block_device(arg), arg); 59 const char *d = find_block_device(arg);
60 /* name is undefined, but device is mounted -> anonymous superblock! */
61 /* happens with btrfs */
62 if (!d) {
63 d = "UNKNOWN";
64 /* TODO: iterate /proc/mounts, or /proc/self/mountinfo
65 * to find out the device name */
66 }
67 printf("%s %s\n", d, arg);
68 }
60 if (!(opt & (OPT_q | OPT_d | OPT_n))) 69 if (!(opt & (OPT_q | OPT_d | OPT_n)))
61 printf("%s is %sa mountpoint\n", arg, is_not_mnt ? "not " : ""); 70 printf("%s is %sa mountpoint\n", arg, is_not_mnt ? "not " : "");
62 return is_not_mnt; 71 return is_not_mnt;