summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/ufs/ufs/ufs_vnops.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 6a936e630b6..38ae58008fc 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_vnops.c,v 1.6 1996/06/27 06:42:09 downsj Exp $ */
+/* $OpenBSD: ufs_vnops.c,v 1.7 1996/10/27 22:30:35 tholo Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */
/*
@@ -672,7 +672,7 @@ ufs_link(v)
#endif
if (vp->v_type == VDIR) {
VOP_ABORTOP(dvp, cnp);
- error = EISDIR;
+ error = EPERM;
goto out2;
}
if (dvp->v_mount != vp->v_mount) {
@@ -888,6 +888,14 @@ abortit:
goto abortit;
}
if ((ip->i_mode & IFMT) == IFDIR) {
+ error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_proc);
+ if (!error && tvp)
+ error = VOP_ACCESS(tvp, VWRITE, tcnp->cn_cred, tcnp->cn_proc);
+ if (error) {
+ VOP_UNLOCK(fvp);
+ error = EACCES;
+ goto abortit;
+ }
/*
* Avoid ".", "..", and aliases of "." for obvious reasons.
*/