1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-15 15:06:42 +00:00

Return EINVAL instead of panicing for rename("dir1", "dir2/..").

Fixes part of PR 760.

This bug seems to be very old.
This commit is contained in:
Bruce Evans 1995-10-07 10:14:12 +00:00
parent 4699383a71
commit 821692d618
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=11297
3 changed files with 8 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $Id: msdosfs_vnops.c,v 1.22 1995/08/25 20:12:23 bde Exp $ */
/* $Id: msdosfs_vnops.c,v 1.23 1995/09/04 00:20:45 dyson Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.20 1994/08/21 18:44:13 ws Exp $ */
/*-
@ -1031,7 +1031,8 @@ msdosfs_rename(ap)
if ((ap->a_fcnp->cn_namelen == 1
&& ap->a_fcnp->cn_nameptr[0] == '.')
|| fddep == fdep
|| (ap->a_fcnp->cn_flags & ISDOTDOT)) {
|| (ap->a_fcnp->cn_flags | ap->a_tcnp->cn_flags)
& ISDOTDOT) {
VOP_ABORTOP(ap->a_tdvp, ap->a_tcnp);
vput(ap->a_tdvp);
if (tvp)

View File

@ -1,4 +1,4 @@
/* $Id: msdosfs_vnops.c,v 1.22 1995/08/25 20:12:23 bde Exp $ */
/* $Id: msdosfs_vnops.c,v 1.23 1995/09/04 00:20:45 dyson Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.20 1994/08/21 18:44:13 ws Exp $ */
/*-
@ -1031,7 +1031,8 @@ msdosfs_rename(ap)
if ((ap->a_fcnp->cn_namelen == 1
&& ap->a_fcnp->cn_nameptr[0] == '.')
|| fddep == fdep
|| (ap->a_fcnp->cn_flags & ISDOTDOT)) {
|| (ap->a_fcnp->cn_flags | ap->a_tcnp->cn_flags)
& ISDOTDOT) {
VOP_ABORTOP(ap->a_tdvp, ap->a_tcnp);
vput(ap->a_tdvp);
if (tvp)

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_vnops.c 8.10 (Berkeley) 4/1/94
* $Id: ufs_vnops.c,v 1.28 1995/09/04 00:21:11 dyson Exp $
* $Id: ufs_vnops.c,v 1.29 1995/09/09 01:43:49 julian Exp $
*/
#include <sys/param.h>
@ -840,7 +840,7 @@ ufs_rename(ap)
* Avoid ".", "..", and aliases of "." for obvious reasons.
*/
if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') ||
dp == ip || (fcnp->cn_flags&ISDOTDOT) ||
dp == ip || (fcnp->cn_flags | tcnp->cn_flags) & ISDOTDOT ||
(ip->i_flag & IN_RENAME)) {
VOP_UNLOCK(fvp);
error = EINVAL;