| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: vfs_syscalls.c,v 1.441 2011/11/18 21:17:45 christos Exp $ */ | | 1 | /* $NetBSD: vfs_syscalls.c,v 1.442 2011/12/02 12:30:14 yamt Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Andrew Doran. | | 8 | * by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -60,27 +60,27 @@ | | | @@ -60,27 +60,27 @@ |
60 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 60 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
61 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 61 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
62 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 62 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
63 | * SUCH DAMAGE. | | 63 | * SUCH DAMAGE. |
64 | * | | 64 | * |
65 | * @(#)vfs_syscalls.c 8.42 (Berkeley) 7/31/95 | | 65 | * @(#)vfs_syscalls.c 8.42 (Berkeley) 7/31/95 |
66 | */ | | 66 | */ |
67 | | | 67 | |
68 | /* | | 68 | /* |
69 | * Virtual File System System Calls | | 69 | * Virtual File System System Calls |
70 | */ | | 70 | */ |
71 | | | 71 | |
72 | #include <sys/cdefs.h> | | 72 | #include <sys/cdefs.h> |
73 | __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.441 2011/11/18 21:17:45 christos Exp $"); | | 73 | __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.442 2011/12/02 12:30:14 yamt Exp $"); |
74 | | | 74 | |
75 | #ifdef _KERNEL_OPT | | 75 | #ifdef _KERNEL_OPT |
76 | #include "opt_fileassoc.h" | | 76 | #include "opt_fileassoc.h" |
77 | #include "veriexec.h" | | 77 | #include "veriexec.h" |
78 | #endif | | 78 | #endif |
79 | | | 79 | |
80 | #include <sys/param.h> | | 80 | #include <sys/param.h> |
81 | #include <sys/systm.h> | | 81 | #include <sys/systm.h> |
82 | #include <sys/namei.h> | | 82 | #include <sys/namei.h> |
83 | #include <sys/filedesc.h> | | 83 | #include <sys/filedesc.h> |
84 | #include <sys/kernel.h> | | 84 | #include <sys/kernel.h> |
85 | #include <sys/file.h> | | 85 | #include <sys/file.h> |
86 | #include <sys/fcntl.h> | | 86 | #include <sys/fcntl.h> |
| @@ -3559,30 +3559,29 @@ do_sys_rename(const char *from, const ch | | | @@ -3559,30 +3559,29 @@ do_sys_rename(const char *from, const ch |
3559 | } | | 3559 | } |
3560 | | | 3560 | |
3561 | if (fvp == tdvp) | | 3561 | if (fvp == tdvp) |
3562 | error = EINVAL; | | 3562 | error = EINVAL; |
3563 | | | 3563 | |
3564 | /* | | 3564 | /* |
3565 | * Source and destination refer to the same object. | | 3565 | * Source and destination refer to the same object. |
3566 | */ | | 3566 | */ |
3567 | if (fvp == tvp) { | | 3567 | if (fvp == tvp) { |
3568 | if (retain) | | 3568 | if (retain) |
3569 | error = -1; | | 3569 | error = -1; |
3570 | else if (fromnd.ni_dvp == tdvp && | | 3570 | else if (fromnd.ni_dvp == tdvp && |
3571 | fromnd.ni_cnd.cn_namelen == tond.ni_cnd.cn_namelen && | | 3571 | fromnd.ni_cnd.cn_namelen == tond.ni_cnd.cn_namelen && |
3572 | !memcmp(fromnd.ni_cnd.cn_nameptr, | | 3572 | !memcmp(fromnd.ni_cnd.cn_nameptr, tond.ni_cnd.cn_nameptr, |
3573 | tond.ni_cnd.cn_nameptr, | | | |
3574 | fromnd.ni_cnd.cn_namelen)) | | 3573 | fromnd.ni_cnd.cn_namelen)) |
3575 | error = -1; | | 3574 | error = -1; |
3576 | } | | 3575 | } |
3577 | /* | | 3576 | /* |
3578 | * Prevent cross-mount operation. | | 3577 | * Prevent cross-mount operation. |
3579 | */ | | 3578 | */ |
3580 | if (error == 0) { | | 3579 | if (error == 0) { |
3581 | if (tond.ni_dvp->v_mount != fromnd.ni_dvp->v_mount) { | | 3580 | if (tond.ni_dvp->v_mount != fromnd.ni_dvp->v_mount) { |
3582 | error = EXDEV; | | 3581 | error = EXDEV; |
3583 | } | | 3582 | } |
3584 | } | | 3583 | } |
3585 | #if NVERIEXEC > 0 | | 3584 | #if NVERIEXEC > 0 |
3586 | if (!error) { | | 3585 | if (!error) { |
3587 | char *f1, *f2; | | 3586 | char *f1, *f2; |
3588 | size_t f1_len; | | 3587 | size_t f1_len; |