Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern But rename(..., "x/..") is still supposed to yield ...



details:   https://anonhg.NetBSD.org/src/rev/5b0ea786eb2e
branches:  trunk
changeset: 337276:5b0ea786eb2e
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Apr 09 05:08:15 2015 +0000

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

diffstat:

 sys/kern/vfs_syscalls.c |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (40 lines):

diff -r bebef6f8a080 -r 5b0ea786eb2e sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Thu Apr 09 05:03:58 2015 +0000
+++ b/sys/kern/vfs_syscalls.c   Thu Apr 09 05:08:15 2015 +0000
@@ -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 @@
         * 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,



Home | Main Index | Thread Index | Old Index