Fix O_NOFOLLOW and do not follow softlinks if O_EXCL.
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 7 May 2009 00:27:58 +0000 (17:27 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 7 May 2009 00:27:58 +0000 (17:27 -0700)
A bug in sys_open() set NLC_FOLLOW bit for the nlookup() call unconditionally.
Removing the setting allows vn_open() to properly set NLC_FOLLOW conditionally
when both O_EXCL and O_NOFOLLOW are not set.

sys/kern/vfs_syscalls.c

index a889135..3070699 100644 (file)
@@ -1827,7 +1827,7 @@ sys_open(struct open_args *uap)
        struct nlookupdata nd;
        int error;
 
-       error = nlookup_init(&nd, uap->path, UIO_USERSPACE, NLC_FOLLOW);
+       error = nlookup_init(&nd, uap->path, UIO_USERSPACE, 0);
        if (error == 0) {
                error = kern_open(&nd, uap->flags,
                                    uap->mode, &uap->sysmsg_result);