aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdio/refill.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/refill.c')
-rw-r--r--newlib/libc/stdio/refill.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/newlib/libc/stdio/refill.c b/newlib/libc/stdio/refill.c
index 639ce6e..047387e 100644
--- a/newlib/libc/stdio/refill.c
+++ b/newlib/libc/stdio/refill.c
@@ -19,6 +19,7 @@
#include <_ansi.h>
#include <stdio.h>
#include <stdlib.h>
+#include <errno.h>
#include "local.h"
static int
@@ -36,7 +37,8 @@ _DEFUN(lflush, (fp),
*/
int
-_DEFUN(__srefill, (fp),
+_DEFUN(__srefill_r, (ptr, fp),
+ struct _reent * ptr _AND
register FILE * fp)
{
/* make sure stdio is set up */
@@ -55,7 +57,11 @@ _DEFUN(__srefill, (fp),
if ((fp->_flags & __SRD) == 0)
{
if ((fp->_flags & __SRW) == 0)
- return EOF;
+ {
+ ptr->_errno = EBADF;
+ fp->_flags |= __SERR;
+ return EOF;
+ }
/* switch to reading */
if (fp->_flags & __SWR)
{