summaryrefslogtreecommitdiff
path: root/lib/libc/stdio
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2014-11-25 19:08:15 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2014-11-25 19:08:15 +0000
commit06ec3a6071d5b5ba6535c01729ca27e026d1b863 (patch)
tree349e2aac564f758463c0e9ff6ecafe854dfcca90 /lib/libc/stdio
parent78f827473f96f5e290795d024fa73b5a35b1c902 (diff)
C99 says setvbuf() returns non-zero, not EOF. Also, POSIX documents
that it returns an error for invalid mode which matches our behavior. OK jmc@ deraadt@
Diffstat (limited to 'lib/libc/stdio')
-rw-r--r--lib/libc/stdio/setbuf.325
-rw-r--r--lib/libc/stdio/setvbuf.322
2 files changed, 37 insertions, 10 deletions
diff --git a/lib/libc/stdio/setbuf.3 b/lib/libc/stdio/setbuf.3
index 1a6873c8a7c..8dd17acaa65 100644
--- a/lib/libc/stdio/setbuf.3
+++ b/lib/libc/stdio/setbuf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: setbuf.3,v 1.15 2014/11/25 17:01:49 millert Exp $
+.\" $OpenBSD: setbuf.3,v 1.16 2014/11/25 19:08:14 millert Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -82,12 +82,27 @@ function is exactly equivalent to the call:
.Pp
.Dl "setvbuf(stream, NULL, _IOLBF, 0);"
.Sh RETURN VALUES
+Upon successful completion, the
+.Fn setlinebuf
+function returns 0.
+If the request cannot be honored, a non-zero value is returned,
+possibly setting
+.Va errno
+to indicate the error.
+The stream is not modified in the error case.
+.Sh ERRORS
The
+.Fn setbuf ,
+.Fn setbuffer ,
+and
.Fn setlinebuf
-function returns 0 on success, or
-.Dv EOF
-if the request cannot be honored
-(note that the stream is still functional in this case).
+functions will fail if:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa stream
+specified is not associated with a valid file descriptor.
+.El
.Sh SEE ALSO
.Xr fclose 3 ,
.Xr fopen 3 ,
diff --git a/lib/libc/stdio/setvbuf.3 b/lib/libc/stdio/setvbuf.3
index ae3abb7c1ef..edee931eb80 100644
--- a/lib/libc/stdio/setvbuf.3
+++ b/lib/libc/stdio/setvbuf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: setvbuf.3,v 1.1 2014/11/25 17:01:49 millert Exp $
+.\" $OpenBSD: setvbuf.3,v 1.2 2014/11/25 19:08:14 millert Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -125,12 +125,24 @@ and before any
.Tn I/O
is performed.
.Sh RETURN VALUES
+Upon successful completion, a value of 0 is returned.
+If
+.Fa mode
+is invalid or if the request cannot be honored, a non-zero value is returned,
+possibly setting
+.Va errno
+to indicate the error.
+The stream is not modified in the error case.
+.Sh ERRORS
The
.Fn setvbuf
-function returns 0 on success, or
-.Dv EOF
-if the request cannot be honored
-(note that the stream is still functional in this case).
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa stream
+specified is not associated with a valid file descriptor.
+.El
.Sh SEE ALSO
.Xr fclose 3 ,
.Xr fopen 3 ,