summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rpc.umntall/rpc.umntall.c
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2001-07-22 12:17:51 +0000
committeriedowse <iedowse@FreeBSD.org>2001-07-22 12:17:51 +0000
commitcc2212999ed6108a836e20287c8217d6b8eac8dc (patch)
tree1635ec3fca73ad3d67d4ea18731dd8f35c2d5f6b /usr.sbin/rpc.umntall/rpc.umntall.c
parentb836d8030e4090784be57170b598076205d08736 (diff)
downloadFreeBSD-src-cc2212999ed6108a836e20287c8217d6b8eac8dc.zip
FreeBSD-src-cc2212999ed6108a836e20287c8217d6b8eac8dc.tar.gz
Fix some bugs and general brain damage in mounttab:
- Declare mtabhead as an extern in mounttab.h and define it only in mounttab.c. - Remove shared global `verbose' and instead pass it as a parameter. - Remove the `mtabp' argument to read_mtab(). It served no purpose whatsoever, although read_mtab() did use it as a temporary local variable. - Don't check for impossible conditions when parsing mounttab, and do detect zero-length fields. - Correctly test for strtoul() failures - just testing ERANGE is wrong. - Include a field name in syslog errors, and avoid passing NULL to a syslog %s field. - Don't test if arrays are NULL. - If there are duplicates when writing out mounttab, keep the last entry instead of the first, as it will have a later timestamp. - Fix a few formatting issues. Update rpc.umntall and umount to match the mounttab interface changes.
Diffstat (limited to 'usr.sbin/rpc.umntall/rpc.umntall.c')
-rw-r--r--usr.sbin/rpc.umntall/rpc.umntall.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.sbin/rpc.umntall/rpc.umntall.c b/usr.sbin/rpc.umntall/rpc.umntall.c
index cf570f5..f4395a8 100644
--- a/usr.sbin/rpc.umntall/rpc.umntall.c
+++ b/usr.sbin/rpc.umntall/rpc.umntall.c
@@ -54,8 +54,6 @@ static int is_mounted (char *, char *);
static void usage (void);
int xdr_dir (XDR *, char *);
-struct mtablist *mtabhead;
-
int
main(int argc, char **argv) {
int ch, keep, success, pathlen;
@@ -100,7 +98,7 @@ main(int argc, char **argv) {
time(&now);
/* Read PATH_MOUNTTAB. */
- if (!read_mtab(NULL)) {
+ if (!read_mtab()) {
if (verbose)
warnx("no mounttab entries (%s does not exist)",
PATH_MOUNTTAB);
@@ -133,7 +131,8 @@ main(int argc, char **argv) {
warnx("umount RPC for %s:%s succeeded",
mtab->mtab_host, mtab->mtab_dirp);
/* Remove all entries for this host + path. */
- clean_mtab(mtab->mtab_host, mtab->mtab_dirp);
+ clean_mtab(mtab->mtab_host, mtab->mtab_dirp,
+ verbose);
}
}
success = 1;
@@ -158,11 +157,11 @@ main(int argc, char **argv) {
}
/* If successful, remove any corresponding mounttab entries. */
if (success)
- clean_mtab(host, path);
+ clean_mtab(host, path, verbose);
}
/* Write and unlink PATH_MOUNTTAB if necessary */
if (success)
- success = write_mtab();
+ success = write_mtab(verbose);
free_mtab();
exit (success ? 0 : 1);
}
OpenPOWER on IntegriCloud