summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_mount.c
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2003-09-08 16:23:21 +0000
committeriedowse <iedowse@FreeBSD.org>2003-09-08 16:23:21 +0000
commit2e1d99cc8a99496e19013067b66e5e4e0fe8c05f (patch)
tree42b140e8967958d7bc2fea81e82e3032b39e11f9 /sys/kern/vfs_mount.c
parentcd2dfb97f8ee012b0b9b7c118bd70050379a8afd (diff)
downloadFreeBSD-src-2e1d99cc8a99496e19013067b66e5e4e0fe8c05f.zip
FreeBSD-src-2e1d99cc8a99496e19013067b66e5e4e0fe8c05f.tar.gz
In the !MNT_BYFSID case, return EINVAL from unmount(2) when the
specified directory is not found in the mount list. Before the MNT_BYFSID changes, unmount(2) used to return ENOENT for a nonexistent path and EINVAL for a non-mountpoint, but we can no longer distinguish between these cases. Of the two error codes, EINVAL was more likely to occur in practice, and it was the only one of the two that was documented. Update the manual page to match the current behaviour. Suggested by: tjr Reviewed by: tjr
Diffstat (limited to 'sys/kern/vfs_mount.c')
-rw-r--r--sys/kern/vfs_mount.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 7d166f0..efc7874 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1255,8 +1255,15 @@ unmount(td, uap)
mtx_unlock(&mountlist_mtx);
}
free(pathbuf, M_TEMP);
- if (mp == NULL)
- return (ENOENT);
+ if (mp == NULL) {
+ /*
+ * Previously we returned ENOENT for a nonexistent path and
+ * EINVAL for a non-mountpoint. We cannot tell these apart
+ * now, so in the !MNT_BYFSID case return the more likely
+ * EINVAL for compatibility.
+ */
+ return ((uap->flags & MNT_BYFSID) ? ENOENT : EINVAL);
+ }
/*
* Only root, or the user that did the original mount is
OpenPOWER on IntegriCloud