aboutsummaryrefslogtreecommitdiff
path: root/sbin/umount
diff options
context:
space:
mode:
authorIan Dowse <iedowse@FreeBSD.org>2001-07-22 12:17:51 +0000
committerIan Dowse <iedowse@FreeBSD.org>2001-07-22 12:17:51 +0000
commitafe1ef249f67c207515285f01df1b3467e822917 (patch)
tree1635ec3fca73ad3d67d4ea18731dd8f35c2d5f6b /sbin/umount
parentb21b2f313e35cdc607bf354ecf685a638788c5d7 (diff)
downloadsrc-afe1ef249f67c207515285f01df1b3467e822917.tar.gz
src-afe1ef249f67c207515285f01df1b3467e822917.zip
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.
Notes
Notes: svn path=/head/; revision=80146
Diffstat (limited to 'sbin/umount')
-rw-r--r--sbin/umount/umount.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c
index 02ef3eddac4d..5c9bb7bd4e7a 100644
--- a/sbin/umount/umount.c
+++ b/sbin/umount/umount.c
@@ -68,7 +68,6 @@ static const char rcsid[] =
typedef enum { MNTON, MNTFROM, NOTHING } mntwhat;
typedef enum { MARK, UNMARK, NAME, COUNT, FREE } dowhat;
-struct mtablist *mtabhead;
struct addrinfo *nfshost_ai = NULL;
int fflag, vflag;
char *nfshost;
@@ -473,9 +472,9 @@ umountfs(char *mntfromname, char *mntonname, char *type)
/*
* Remove the unmounted entry from /var/db/mounttab.
*/
- if (read_mtab(NULL)) {
- clean_mtab(hostp, nfsdirname);
- if(!write_mtab())
+ if (read_mtab()) {
+ clean_mtab(hostp, nfsdirname, vflag);
+ if(!write_mtab(vflag))
warnx("cannot remove mounttab entry %s:%s",
hostp, nfsdirname);
free_mtab();