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)
This commit is contained in:
iedowse 2003-12-05 09:36:56 +00:00
parent 773cacebe4
commit a59e5c9ced

View File

@ -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");
}