diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-10-27 22:30:36 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-10-27 22:30:36 +0000 |
commit | bfda6893cf2f9740fb3b4decefbc43d3e89c67d0 (patch) | |
tree | 76f90b286918d5408b80a0c0396a6831e7cba69a /sys | |
parent | 7d71d275281742b2ddab579ff2fa5e7fe3b3e025 (diff) |
Correct error return for link(2) to directories
Fail rename(2) on directories if one or both directories does not have
write permission
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 12 |
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. */ |