From 82000ec41c3676aa5eb3698ce6beb029cace565d Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Tue, 3 Feb 1998 17:23:26 +0000 Subject: [PATCH] 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. --- sbin/umount/umount.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c index 8351cea23bff..5fe0d4718c42 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);