Module Name:    src
Committed By:   jruoho
Date:           Thu May  6 08:14:08 UTC 2010

Modified Files:
        src/lib/libc/stdio: ferror.3

Log Message:
Correct the discussion about return values: fileno() may fail and return -1.
Note that in such cases the NetBSD implementation does not set errno to
EBADF, hence diverging from the standard in this small detail.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/stdio/ferror.3

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/ferror.3
diff -u src/lib/libc/stdio/ferror.3:1.11 src/lib/libc/stdio/ferror.3:1.12
--- src/lib/libc/stdio/ferror.3:1.11	Thu Aug  7 16:43:22 2003
+++ src/lib/libc/stdio/ferror.3	Thu May  6 08:14:08 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ferror.3,v 1.11 2003/08/07 16:43:22 agc Exp $
+.\"	$NetBSD: ferror.3,v 1.12 2010/05/06 08:14:08 jruoho Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\"     @(#)ferror.3	8.2 (Berkeley) 4/19/94
 .\"
-.Dd April 19, 1994
+.Dd May 6, 2010
 .Dt FERROR 3
 .Os
 .Sh NAME
@@ -84,9 +84,26 @@
 .Fa stream
 and returns its integer descriptor.
 .Sh ERRORS
-These functions should not fail and do not set the external
-variable
+The functions
+.Fn clearerr ,
+.Fn feof ,
+and
+.Fn ferror
+should neither fail nor set the external variable
 .Va errno .
+However, the function
+.Fn fileno
+may fail and return \-1 in case the argument
+.Fa stream
+is not associated with a valid file descriptor.
+(In such case the
+.Nx
+implementation, contrary to the
+.Tn POSIX
+standard, does not set
+.Va errno
+to
+.Er EBADF . )
 .Sh SEE ALSO
 .Xr open 2 ,
 .Xr stdio 3

Reply via email to