From 05779418cd12f1edec6fd65c49cd1ef94592e679 Mon Sep 17 00:00:00 2001 From: Ian Dowse Date: Fri, 5 Dec 2003 09:36:56 +0000 Subject: [PATCH] Don't include the file system ID in the output of `mount -v' if it is all zeros. The kernel now consistently zeroes FSIDs for non-root users, so there's no point in printing these. Also fix a number of compiler warnings, including two real bugs: - a bracket placement bug caused `mount -t ufs localhost:/foo /mnt' to override the `-t ufs' specification and use mount_nfs. - an unitialised variable was used instead of _PATH_SYSPATH when warning that the mount_* program cound not be found. Submitted by: Rudolf Cejka (FSID part) Approved by: re (scottl) --- sbin/mount/mount.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 40478cb35ae0..ff4fb8c2b784 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -292,8 +292,8 @@ main(argc, argv) * ':' will be correctly parsed only if the separator is '@'. * The definition of a valid hostname is taken from RFC 1034. */ - if (vfslist == NULL && ((ep = strchr(argv[0], '@')) != NULL) || - ((ep = strchr(argv[0], ':')) != NULL)) { + if (vfslist == NULL && ((ep = strchr(argv[0], '@')) != NULL || + (ep = strchr(argv[0], ':')) != NULL)) { if (*ep == '@') { cp = ep + 1; ep = cp + strlen(cp); @@ -393,8 +393,7 @@ mountfs(vfstype, spec, name, flags, options, mntopts) const char *vfstype, *spec, *name, *options, *mntopts; int flags; { - const char *argv[100], **edir; - char *path, *cur; + const char *argv[100]; struct statfs sf; pid_t pid; int argc, i, status; @@ -468,7 +467,8 @@ mountfs(vfstype, spec, name, flags, options, mntopts) (void)snprintf(execname, sizeof(execname), "mount_%s", vfstype); execvP(execname, _PATH_SYSPATH, (char * const *)argv); if (errno == ENOENT) { - warn("exec mount_%s not found in %s", vfstype, path); + warn("exec mount_%s not found in %s", vfstype, + _PATH_SYSPATH); } exit(1); /* NOTREACHED */ @@ -531,13 +531,15 @@ prmount(sfp) if (verbose) { if (sfp->f_syncwrites != 0 || sfp->f_asyncwrites != 0) (void)printf(", writes: sync %ld async %ld", - sfp->f_syncwrites, sfp->f_asyncwrites); + (long)sfp->f_syncwrites, (long)sfp->f_asyncwrites); if (sfp->f_syncreads != 0 || sfp->f_asyncreads != 0) (void)printf(", reads: sync %ld async %ld", - sfp->f_syncreads, sfp->f_asyncreads); - printf(", fsid "); - for (i = 0; i < sizeof(sfp->f_fsid); i++) - printf("%02x", ((u_char *)&sfp->f_fsid)[i]); + (long)sfp->f_syncreads, (long)sfp->f_asyncreads); + if (sfp->f_fsid.val[0] != 0 || sfp->f_fsid.val[1] != 0) { + printf(", fsid "); + for (i = 0; i < sizeof(sfp->f_fsid); i++) + printf("%02x", ((u_char *)&sfp->f_fsid)[i]); + } } (void)printf(")\n"); }