Module Name:    src
Committed By:   drochner
Date:           Fri Sep 10 10:29:23 UTC 2010

Modified Files:
        src/lib/libc/stdio: refill.c

Log Message:
apply an 11 years old fix from FreeBSD:
if EBADF is returned due to a read from a write-only stream, also
set ferror()
found by a selftest of Python-2.6.6, thanks to obache for pointing
out the details


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/stdio/refill.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/stdio/refill.c
diff -u src/lib/libc/stdio/refill.c:1.13 src/lib/libc/stdio/refill.c:1.14
--- src/lib/libc/stdio/refill.c:1.13	Thu Aug  7 16:43:30 2003
+++ src/lib/libc/stdio/refill.c	Fri Sep 10 10:29:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: refill.c,v 1.13 2003/08/07 16:43:30 agc Exp $	*/
+/*	$NetBSD: refill.c,v 1.14 2010/09/10 10:29:23 drochner Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)refill.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: refill.c,v 1.13 2003/08/07 16:43:30 agc Exp $");
+__RCSID("$NetBSD: refill.c,v 1.14 2010/09/10 10:29:23 drochner Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -91,6 +91,7 @@
 	if ((fp->_flags & __SRD) == 0) {
 		if ((fp->_flags & __SRW) == 0) {
 			errno = EBADF;
+			fp->_flags |= __SERR;
 			return (EOF);
 		}
 		/* switch to reading */

Reply via email to