Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/stdio Correct the discussion about return values: f...



details:   https://anonhg.NetBSD.org/src/rev/83867460ec12
branches:  trunk
changeset: 754612:83867460ec12
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Thu May 06 08:14:08 2010 +0000

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

diffstat:

 lib/libc/stdio/ferror.3 |  25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diffs (47 lines):

diff -r 11c94c123ce9 -r 83867460ec12 lib/libc/stdio/ferror.3
--- a/lib/libc/stdio/ferror.3   Thu May 06 08:02:47 2010 +0000
+++ b/lib/libc/stdio/ferror.3   Thu May 06 08:14:08 2010 +0000
@@ -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



Home | Main Index | Thread Index | Old Index