Module Name:    src
Committed By:   njoly
Date:           Thu May 28 14:48:20 UTC 2009

Modified Files:
        src/sys/compat/osf1: osf1_file.c

Log Message:
Make getdirentries(2) correctly fail with EINVAL for an invalid file
descriptor (not for a directory), by not updating basep syscall
argument on error.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/compat/osf1/osf1_file.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/compat/osf1/osf1_file.c
diff -u src/sys/compat/osf1/osf1_file.c:1.33 src/sys/compat/osf1/osf1_file.c:1.34
--- src/sys/compat/osf1/osf1_file.c:1.33	Mon May 18 12:39:02 2009
+++ src/sys/compat/osf1/osf1_file.c	Thu May 28 14:48:20 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_file.c,v 1.33 2009/05/18 12:39:02 njoly Exp $ */
+/* $NetBSD: osf1_file.c,v 1.34 2009/05/28 14:48:20 njoly Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: osf1_file.c,v 1.33 2009/05/18 12:39:02 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: osf1_file.c,v 1.34 2009/05/28 14:48:20 njoly Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_syscall_debug.h"
@@ -245,7 +245,7 @@
 	free(buf, M_TEMP);
 out1:
 	fd_putfile(fd);
-	if (SCARG(uap, basep) != NULL)
+	if (error == 0 && SCARG(uap, basep) != NULL)
 		error = copyout(&eofflag, SCARG(uap, basep), sizeof(long));
 	return error;
 }

Reply via email to