Module Name:    src
Committed By:   martin
Date:           Sun Feb 12 13:12:45 UTC 2012

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

Log Message:
fd_open(): fix confusion between userland and kernel encoding of open flags


To generate a diff of this commit:
cvs rdiff -u -r1.448 -r1.449 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.448 src/sys/kern/vfs_syscalls.c:1.449
--- src/sys/kern/vfs_syscalls.c:1.448	Sat Feb 11 23:16:17 2012
+++ src/sys/kern/vfs_syscalls.c	Sun Feb 12 13:12:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.448 2012/02/11 23:16:17 martin Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.449 2012/02/12 13:12:45 martin 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.448 2012/02/11 23:16:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.449 2012/02/12 13:12:45 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -1525,8 +1525,10 @@ int
 fd_open(const char *path, int open_flags, int open_mode, int *fd)
 {
 	struct pathbuf *pb;
+	int oflags;
 
-	if ((open_flags & (FREAD | FWRITE)) == 0)
+	oflags = FFLAGS(open_flags);
+	if ((oflags & (FREAD | FWRITE)) == 0)
 		return EINVAL;
 
 	pb = pathbuf_create(path);

Reply via email to