summaryrefslogtreecommitdiffstats
path: root/sbin/umount
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1998-01-19 18:48:36 +0000
committerbde <bde@FreeBSD.org>1998-01-19 18:48:36 +0000
commite8eec81f3fdd05d108f34c6aebe6748499d2a5f8 (patch)
treed82fc81486219f23131f2e93347c9b746c348aba /sbin/umount
parent304706617a7bac3b2f15d160e929c5e285f17d8a (diff)
downloadFreeBSD-src-e8eec81f3fdd05d108f34c6aebe6748499d2a5f8.zip
FreeBSD-src-e8eec81f3fdd05d108f34c6aebe6748499d2a5f8.tar.gz
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
Diffstat (limited to 'sbin/umount')
-rw-r--r--sbin/umount/umount.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c
index fe42c19..8351cea 100644
--- a/sbin/umount/umount.c
+++ b/sbin/umount/umount.c
@@ -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);
OpenPOWER on IntegriCloud