From b160131f8a73b7482c6ed0a1780d3bcf7921ee9e Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Sun, 21 Apr 2013 11:05:15 +0000 Subject: When mount(1) is run in verbose mode, display f_mntfromspec if it differs from f_mntfromname. ok krw@ --- sbin/mount/mount.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'sbin/mount/mount.c') 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; -- cgit v1.2.3