diff options
author | iedowse <iedowse@FreeBSD.org> | 2003-12-05 09:36:56 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2003-12-05 09:36:56 +0000 |
commit | 4799825f09995f719b5c1ba28c3de9548cbad45b (patch) | |
tree | 3c31e6609e99d96dc8b6d4578f3129a4d9ffc00a /sbin/mount/mount.c | |
parent | 89f6e4a2b813c980e3f878ab6803bab1065b6a70 (diff) | |
download | FreeBSD-src-4799825f09995f719b5c1ba28c3de9548cbad45b.zip FreeBSD-src-4799825f09995f719b5c1ba28c3de9548cbad45b.tar.gz |
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 <cejkar@fit.vutbr.cz> (FSID part)
Approved by: re (scottl)
Diffstat (limited to 'sbin/mount/mount.c')
-rw-r--r-- | sbin/mount/mount.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 40478cb..ff4fb8c 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"); } |