mount(8) only uses realpath() for the mountpoint, so don't look up the

real path here for the mount device (or path).  This fixes difficulties
unmounting devices that are actually symlinks to real devices.

Also, print the original path instead of the real path in early error
messages.  nfs path handling and later error messages may still be wrong,
probably only in silly cases where the original path is both a symlink
and a remote path.

PR:		5208
This commit is contained in:
Bruce Evans 1998-01-19 18:48:36 +00:00
parent 281c79d603
commit bd4f43ff72

View File

@ -219,25 +219,25 @@ umountfs(name, typelist)
strcpy(rname, name);
}
name = rname;
if (stat(name, &sb) < 0) {
if (((mntpt = getmntname(name, MNTFROM, &type)) == NULL) &&
if (((mntpt = 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 = name;
if ((name = getmntname(mntpt, MNTFROM, &type)) == NULL) {
warnx("%s: not currently mounted", mntpt);
if ((name = getmntname(rname, MNTFROM, &type)) == NULL) {
warnx("%s: not currently mounted", name);
return (1);
}
mntpt = rname;
} else {
warnx("%s: not a directory or special device", name);
return (1);