Source-Changes-HG archive

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

[src/trunk]: src/sys/kern A syscall like posix_fallocate() that is not suppos...



details:   https://anonhg.NetBSD.org/src/rev/cde30d589fb4
branches:  trunk
changeset: 806312:cde30d589fb4
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Feb 15 10:48:21 2015 +0000

description:
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.

diffstat:

 sys/kern/vfs_syscalls.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r 85fc42d018ce -r cde30d589fb4 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Sun Feb 15 10:48:13 2015 +0000
+++ b/sys/kern/vfs_syscalls.c   Sun Feb 15 10:48:21 2015 +0000
@@ -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 @@
        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 @@
 
 fail:
        fd_putfile(fd);
-       return error;
+       *retval = error;
+       return 0;
 }
 
 /*



Home | Main Index | Thread Index | Old Index