From 88348faf5b464209aed4e508547cf9411b1dd98f Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 11 Mar 2008 19:08:39 +0000 Subject: [PATCH] 2008-03-11 Jeff Johnston * libc/stdio/rgetc.c (__srget): Invoke CHECK_INIT to ensure stdin gets resolved properly before refilling. --- newlib/ChangeLog | 5 +++++ newlib/libc/stdio/rget.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 0a8a9d0a9..93000d4e3 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2008-03-11 Jeff Johnston + + * libc/stdio/rgetc.c (__srget): Invoke CHECK_INIT to ensure + stdin gets resolved properly before refilling. + 2008-03-07 Jeff Johnston * libc/include/getopt.h: Hide newlib extensions under diff --git a/newlib/libc/stdio/rget.c b/newlib/libc/stdio/rget.c index 0444acee3..0a1cc147f 100644 --- a/newlib/libc/stdio/rget.c +++ b/newlib/libc/stdio/rget.c @@ -36,6 +36,10 @@ _DEFUN(__srget_r, (ptr, fp), struct _reent *ptr _AND register FILE *fp) { + /* Ensure that any fake std stream is resolved before + we call __srefill_r so we may access the true read buffer. */ + CHECK_INIT(fp); + if (__srefill_r (ptr, fp) == 0) { fp->_r--;