diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-10-26 06:58:59 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-10-26 06:58:59 +0000 |
commit | 01c1bbee8e593d4a9d39643cf7389aebdab9d6b7 (patch) | |
tree | 66a264adbefb7be3c96f3fd64d9fb53ad551a2fc /lib/libc/stdio | |
parent | 7e951c2856ce78b0215f0290bb75e6de0f8fa40f (diff) |
Set errno when trying to write to a read-only stream
Diffstat (limited to 'lib/libc/stdio')
-rw-r--r-- | lib/libc/stdio/fvwrite.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/stdio/fvwrite.c b/lib/libc/stdio/fvwrite.c index 029e8b184ca..aa4108b16a1 100644 --- a/lib/libc/stdio/fvwrite.c +++ b/lib/libc/stdio/fvwrite.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: fvwrite.c,v 1.2 1996/08/19 08:32:49 tholo Exp $"; +static char rcsid[] = "$OpenBSD: fvwrite.c,v 1.3 1996/10/26 06:58:58 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> @@ -63,8 +63,10 @@ __sfvwrite(fp, uio) if ((len = uio->uio_resid) == 0) return (0); /* make sure we can write */ - if (cantwrite(fp)) + if (cantwrite(fp)) { + errno = EBADF; return (EOF); + } #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define COPY(n) (void)memcpy((void *)fp->_p, (void *)p, (size_t)(n)) |