summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/wbuf.c
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1997-05-31 08:45:52 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1997-05-31 08:45:52 +0000
commit174fcfe6e6224edfb629930ecfdaebfa8e5273a5 (patch)
treef1370fbbc839818786c338173cc5a28581e4ce3a /lib/libc/stdio/wbuf.c
parentd182c568403712b5413cbc6757a83964c8c269af (diff)
Set errno to EBADF when trying to write to a stream not open for writing;
required by POSIX
Diffstat (limited to 'lib/libc/stdio/wbuf.c')
-rw-r--r--lib/libc/stdio/wbuf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/stdio/wbuf.c b/lib/libc/stdio/wbuf.c
index 0cef3704a27..ae6f05ca6a9 100644
--- a/lib/libc/stdio/wbuf.c
+++ b/lib/libc/stdio/wbuf.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: wbuf.c,v 1.2 1996/08/19 08:33:15 tholo Exp $";
+static char rcsid[] = "$OpenBSD: wbuf.c,v 1.3 1997/05/31 08:45:51 tholo Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -60,8 +60,10 @@ __swbuf(c, fp)
* calls might wrap _w from negative to positive.
*/
fp->_w = fp->_lbfsize;
- if (cantwrite(fp))
+ if (cantwrite(fp)) {
+ errno = EBADF;
return (EOF);
+ }
c = (unsigned char)c;
/*