Module Name:    src
Committed By:   riastradh
Date:           Thu Apr  9 05:08:15 UTC 2015

Modified Files:
        src/sys/kern: vfs_syscalls.c

Log Message:
But rename(..., "x/..") is still supposed to yield EINVAL.  Go figure.


To generate a diff of this commit:
cvs rdiff -u -r1.494 -r1.495 src/sys/kern/vfs_syscalls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.494 src/sys/kern/vfs_syscalls.c:1.495
--- src/sys/kern/vfs_syscalls.c:1.494	Thu Apr  9 05:03:58 2015
+++ src/sys/kern/vfs_syscalls.c	Thu Apr  9 05:08:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.494 2015/04/09 05:03:58 riastradh Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.495 2015/04/09 05:08:15 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.494 2015/04/09 05:03:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.495 2015/04/09 05:08:15 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -4281,14 +4281,16 @@ do_sys_renameat(struct lwp *l, int fromf
 	 * until the VOP_RENAME protocol changes, because file systems
 	 * will no doubt begin to depend on this check.
 	 */
-	if (((tnd.ni_cnd.cn_namelen == 1) &&
-		(tnd.ni_cnd.cn_nameptr[0] == '.')) ||
-	    ((tnd.ni_cnd.cn_namelen == 2) &&
-		(tnd.ni_cnd.cn_nameptr[0] == '.') &&
-		(tnd.ni_cnd.cn_nameptr[1] == '.'))) {
+	if ((tnd.ni_cnd.cn_namelen == 1) && (tnd.ni_cnd.cn_nameptr[0] == '.')) {
 		error = EISDIR;
 		goto abort1;
 	}
+	if ((tnd.ni_cnd.cn_namelen == 2) &&
+	    (tnd.ni_cnd.cn_nameptr[0] == '.') &&
+	    (tnd.ni_cnd.cn_nameptr[1] == '.')) {
+		error = EINVAL;
+		goto abort1;
+	}
 
 	/*
 	 * Get the mount point.  If the file system has been unmounted,

Reply via email to