Module Name:    src
Committed By:   martin
Date:           Sun Feb 15 10:48:22 UTC 2015

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

Log Message:
A syscall like posix_fallocate() that is not supposed to set errno in
userland needs to always return 0 and store the error code *retval.


To generate a diff of this commit:
cvs rdiff -u -r1.492 -r1.493 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.492 src/sys/kern/vfs_syscalls.c:1.493
--- src/sys/kern/vfs_syscalls.c:1.492	Wed Nov 26 10:50:36 2014
+++ src/sys/kern/vfs_syscalls.c	Sun Feb 15 10:48:21 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.492 2014/11/26 10:50:36 manu Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.493 2015/02/15 10:48:21 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.492 2014/11/26 10:50:36 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.493 2015/02/15 10:48:21 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -4716,12 +4716,14 @@ sys_posix_fallocate(struct lwp *l, const
 	len = SCARG(uap, len);
 	
 	if (pos < 0 || len < 0 || len > OFF_T_MAX - pos) {
-		return EINVAL;
+		*retval = EINVAL;
+		return 0;
 	}
 	
 	error = fd_getvnode(fd, &fp);
 	if (error) {
-		return error;
+		*retval = error;
+		return 0;
 	}
 	if ((fp->f_flag & FWRITE) == 0) {
 		error = EBADF;
@@ -4739,7 +4741,8 @@ sys_posix_fallocate(struct lwp *l, const
 
 fail:
 	fd_putfile(fd);
-	return error;
+	*retval = error;
+	return 0;
 }
 
 /*

Reply via email to