From 4226571d7af401f07fea4797b93c2c888f5e9880 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 14 Jun 2011 03:56:05 +0000 Subject: printf: set errno for read-only stream * libc/stdio/wsetup.c (__swsetup_r): Set errno on failure. * libc/stdio/fvwrite.c (__sfvwrite_r): Simplify. * libc/stdio/wbuf.c (__swbuf_r): Likewise. * libc/stdio/local.h (cantwrite): Adjust comment. --- newlib/libc/stdio/wbuf.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'newlib/libc/stdio/wbuf.c') diff --git a/newlib/libc/stdio/wbuf.c b/newlib/libc/stdio/wbuf.c index 33457f0d0..f9197ea9e 100644 --- a/newlib/libc/stdio/wbuf.c +++ b/newlib/libc/stdio/wbuf.c @@ -54,11 +54,7 @@ _DEFUN(__swbuf_r, (ptr, c, fp), fp->_w = fp->_lbfsize; if (cantwrite (ptr, fp)) - { - fp->_flags |= __SERR; - ptr->_errno = EBADF; - return EOF; - } + return EOF; c = (unsigned char) c; ORIENT (fp, -1); -- cgit v1.2.3