diff options
author | green <green@FreeBSD.org> | 1999-10-23 00:54:58 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 1999-10-23 00:54:58 +0000 |
commit | 309540210a9e865a6d20be7df5e9de244a48b047 (patch) | |
tree | c2b473fb51d7863a0025df63053a8a879e2d7571 /sbin/umount | |
parent | 1e1a86c642c05b04b68acddb82e4524ef9c582ee (diff) | |
download | FreeBSD-src-309540210a9e865a6d20be7df5e9de244a48b047.zip FreeBSD-src-309540210a9e865a6d20be7df5e9de244a48b047.tar.gz |
Small bugfixes (point not getting marked in one case, string not NUL and
wrong size in the other.)
Submitted by: Martin Blapp <mb@imp.ch>
Diffstat (limited to 'sbin/umount')
-rw-r--r-- | sbin/umount/umount.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c index 02a3ed4..014509a 100644 --- a/sbin/umount/umount.c +++ b/sbin/umount/umount.c @@ -65,7 +65,7 @@ static const char rcsid[] = typedef enum { MNTON, MNTFROM, NOTHING } mntwhat; typedef enum { MARK, UNMARK, NAME, COUNT, FREE } dowhat; -int fflag, vflag, count; +int fflag, vflag; char *nfshost; void checkmntlist (char *, char **, char **, char **); @@ -93,7 +93,7 @@ main(int argc, char *argv[]) /* Start disks transferring immediately. */ sync(); - all = count = errs = 0; + all = errs = 0; while ((ch = getopt(argc, argv, "Aafh:t:v")) != -1) switch (ch) { case 'A': @@ -243,11 +243,11 @@ umountfs(char *name, char **typelist) struct timeval pertry, try; CLIENT *clp; size_t len; - int so, speclen; + int so, speclen, do_rpc; char *mntonname, *mntfromname; char *mntfromnamerev; char *nfsdirname, *orignfsdirname; - char *resolved, realname[MAXPATHLEN + 1]; + char *resolved, realname[MAXPATHLEN]; char *type, *delimp, *hostp, *origname; len = 0; @@ -387,13 +387,11 @@ umountfs(char *name, char **typelist) * happen before unmount(2), but it should happen * after the previous namecheck. */ - if (!strcmp(type, "nfs")) { - if (getmntname(mntfromname, NULL, NOTHING, - &type, COUNT) == NULL) - count = 1; - else - count = 0; - } + if (strcmp(type, "nfs") == 0 && getmntname(mntfromname, NULL, NOTHING, + &type, COUNT) != NULL) + do_rpc = 1; + else + do_rpc = 0; if (!namematch(hp)) return (1); if (unmount(mntonname, fflag) != 0 ) { @@ -406,7 +404,7 @@ umountfs(char *name, char **typelist) * Report to mountd-server which nfsname * has been unmounted. */ - if (hp != NULL && !(fflag & MNT_FORCE) && count == 0) { + if (hp != NULL && !(fflag & MNT_FORCE) && do_rpc) { memset(&saddr, 0, sizeof(saddr)); saddr.sin_family = AF_INET; saddr.sin_port = 0; @@ -521,8 +519,10 @@ getmntname(const char *fromname, const char *onname, if (strcmp(mntbuf[i].f_mntfromname, fromname) == 0) { if (mntcount[i] == 1) count--; - else + else { mntcount[i] = 1; + break; + } } } if (count <= 1) @@ -612,7 +612,7 @@ getrealname(char *name, char *realname) strcpy(realname, "/"); else { if ((dirname = strrchr(name + 1, '/')) == NULL) - strncpy(realname, name, MAXPATHLEN); + snprintf(realname, MAXPATHLEN, "%s", name); else havedir = 1; } |