summaryrefslogtreecommitdiff
path: root/sbin/mount/mount.c
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2013-04-21 11:05:15 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2013-04-21 11:05:15 +0000
commitb160131f8a73b7482c6ed0a1780d3bcf7921ee9e (patch)
tree7d0232ea43944475a9629196a2892eb2e7b88334 /sbin/mount/mount.c
parentb009552b05e622a36abdd315ca4142d16f1b3505 (diff)
When mount(1) is run in verbose mode, display f_mntfromspec if it differs
from f_mntfromname. ok krw@
Diffstat (limited to 'sbin/mount/mount.c')
-rw-r--r--sbin/mount/mount.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index d612f5da380..f613b675032 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount.c,v 1.53 2012/05/29 20:01:32 landry Exp $ */
+/* $OpenBSD: mount.c,v 1.54 2013/04/21 11:05:14 jsing Exp $ */
/* $NetBSD: mount.c,v 1.24 1995/11/18 03:34:29 cgd Exp $ */
/*
@@ -367,11 +367,16 @@ mountfs(const char *vfstype, const char *spec, const char *name,
/* XXX can't check f_mntfromname, thanks to mfs, etc. */
if (strncmp(name, sf.f_mntonname, MNAMELEN) == 0 &&
strncmp(vfstype, sf.f_fstypename, MFSNAMELEN) == 0) {
- if (verbose)
- (void)printf("%s on %s type %.*s: %s\n",
- sf.f_mntfromname, sf.f_mntonname,
+ if (verbose) {
+ printf("%s", sf.f_mntfromname);
+ if (strncmp(sf.f_mntfromname,
+ sf.f_mntfromspec, MNAMELEN) != 0)
+ printf(" (%s)", sf.f_mntfromspec);
+ printf(" on %s type %.*s: %s\n",
+ sf.f_mntonname,
MFSNAMELEN, sf.f_fstypename,
"already mounted");
+ }
return (0);
}
}
@@ -455,7 +460,11 @@ prmount(struct statfs *sf)
struct opt *o;
int f = 0;
- (void)printf("%s on %s type %.*s", sf->f_mntfromname, sf->f_mntonname,
+ printf("%s", sf->f_mntfromname);
+ if (verbose &&
+ strncmp(sf->f_mntfromname, sf->f_mntfromspec, MNAMELEN) != 0)
+ printf(" (%s)", sf->f_mntfromspec);
+ printf(" on %s type %.*s", sf->f_mntonname,
MFSNAMELEN, sf->f_fstypename);
flags = sf->f_flags & MNT_VISFLAGMASK;