aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdio/getc.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/getc.c')
-rw-r--r--newlib/libc/stdio/getc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/newlib/libc/stdio/getc.c b/newlib/libc/stdio/getc.c
index c878132..12bffaf 100644
--- a/newlib/libc/stdio/getc.c
+++ b/newlib/libc/stdio/getc.c
@@ -81,6 +81,9 @@ _getc_r (struct _reent *ptr,
{
int result;
CHECK_INIT (ptr, fp);
+ if (ORIENT (fp, -1) != -1)
+ return EOF;
+
_newlib_flockfile_start (fp);
result = __sgetc_r (ptr, fp);
_newlib_flockfile_end (fp);
@@ -96,6 +99,9 @@ getc (register FILE *fp)
struct _reent *reent = _REENT;
CHECK_INIT (reent, fp);
+ if (ORIENT (fp, -1) != -1)
+ return EOF;
+
_newlib_flockfile_start (fp);
result = __sgetc_r (reent, fp);
_newlib_flockfile_end (fp);