summaryrefslogtreecommitdiffstats
path: root/sbin/umount
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1998-02-03 17:23:26 +0000
committerbde <bde@FreeBSD.org>1998-02-03 17:23:26 +0000
commit1e193f260047e5316937a8c0cc2ce04a38cca4a1 (patch)
treebe1800a1d368ad65a8e78d5c6ecf564737794419 /sbin/umount
parentf577f8592bb5f72791fe5878fd807ec5b85e3639 (diff)
downloadFreeBSD-src-1e193f260047e5316937a8c0cc2ce04a38cca4a1.zip
FreeBSD-src-1e193f260047e5316937a8c0cc2ce04a38cca4a1.tar.gz
Fixed the previous fix. The original path was annulled when it
was a directory, so the error message for attempting to unmount an unmounted-on directory was more broken than before.
Diffstat (limited to 'sbin/umount')
-rw-r--r--sbin/umount/umount.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c
index 8351cea..5fe0d47 100644
--- a/sbin/umount/umount.c
+++ b/sbin/umount/umount.c
@@ -212,7 +212,7 @@ umountfs(name, typelist)
struct timeval pertry, try;
CLIENT *clp;
int so;
- char *type, *delimp, *hostp, *mntpt, rname[MAXPATHLEN];
+ char *type, *delimp, *hostp, *mntpt, *newname, rname[MAXPATHLEN];
if (realpath(name, rname) == NULL) {
/* Continue and let the system call check it... */
@@ -233,11 +233,12 @@ umountfs(name, typelist)
}
name = rname;
} else if (S_ISDIR(sb.st_mode)) {
- if ((name = getmntname(rname, MNTFROM, &type)) == NULL) {
+ mntpt = rname;
+ if ((newname = getmntname(mntpt, MNTFROM, &type)) == NULL) {
warnx("%s: not currently mounted", name);
return (1);
}
- mntpt = rname;
+ newname = name;
} else {
warnx("%s: not a directory or special device", name);
return (1);
OpenPOWER on IntegriCloud