summaryrefslogtreecommitdiffstats
path: root/sbin/umount
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-05-11 07:38:42 +0000
committerpeter <peter@FreeBSD.org>1998-05-11 07:38:42 +0000
commitf2c6244512d23e45d1cc1876558c7c1f64dfc268 (patch)
treeec8d9d086001407f65fe3e990ff5c0f4136a29a9 /sbin/umount
parentee396db7d3a6e8672a75bb02cff258ca0c155aca (diff)
downloadFreeBSD-src-f2c6244512d23e45d1cc1876558c7c1f64dfc268.zip
FreeBSD-src-f2c6244512d23e45d1cc1876558c7c1f64dfc268.tar.gz
Fix PR 1607, hopefully without breaking the PR 5208 fixes.
umount() was trying to stat() the mountpoint, this would fail if the mountpoint was a NFS mountpoint, and the fallback code would try and pass a hostname:/dir path as the mountpoint to unmount(2), which would fail. This whole stat() of the name supplied on the command line business is trouble as it'll wedge on a hung NFS mount. I'm not entirely sure why we are not simply looking up both arguments in the mount table and doing the right thing without accessing the filesystem. It seems that we're going to a lot of trouble to allow mountpoints on symlinks and other wierd things. PR: 1607
Diffstat (limited to 'sbin/umount')
-rw-r--r--sbin/umount/umount.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c
index 5fe0d47..4c9da5a 100644
--- a/sbin/umount/umount.c
+++ b/sbin/umount/umount.c
@@ -212,37 +212,37 @@ umountfs(name, typelist)
struct timeval pertry, try;
CLIENT *clp;
int so;
- char *type, *delimp, *hostp, *mntpt, *newname, rname[MAXPATHLEN];
+ char *type, *delimp, *hostp, *mntpt, *origname, rname[MAXPATHLEN];
if (realpath(name, rname) == NULL) {
/* Continue and let the system call check it... */
strcpy(rname, name);
}
+ origname = name;
if (stat(name, &sb) < 0) {
- if (((mntpt = getmntname(rname, MNTFROM, &type)) == NULL) &&
+ mntpt = rname;
+ if ((getmntname(rname, MNTFROM, &type) == NULL) &&
((mntpt = getmntname(name, MNTON, &type)) == NULL)) {
warnx("%s: not currently mounted", name);
return (1);
}
- name = rname;
} else if (S_ISBLK(sb.st_mode)) {
if ((mntpt = getmntname(name, MNTON, &type)) == NULL) {
warnx("%s: not currently mounted", name);
return (1);
}
- name = rname;
} else if (S_ISDIR(sb.st_mode)) {
mntpt = rname;
- if ((newname = getmntname(mntpt, MNTFROM, &type)) == NULL) {
+ if (getmntname(mntpt, MNTFROM, &type) == NULL) {
warnx("%s: not currently mounted", name);
return (1);
}
- newname = name;
} else {
warnx("%s: not a directory or special device", name);
return (1);
}
+ name = rname;
if (checkvfsname(type, typelist))
return (1);
@@ -267,7 +267,7 @@ umountfs(name, typelist)
return (1);
if (vflag)
- (void)printf("%s: unmount from %s\n", name, mntpt);
+ (void)printf("%s: unmount from %s\n", origname, mntpt);
if (fake)
return (0);
OpenPOWER on IntegriCloud