From 65b1964f1afbd0a9faea38a4c546b2b5f67f6d20 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 26 Oct 2004 18:21:09 +0000 Subject: 2004-10-26 Jason Tishler * libc/stdio/fread.c (fread): Fix return value for unbuffered fread. --- newlib/libc/stdio/fread.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'newlib/libc/stdio/fread.c') diff --git a/newlib/libc/stdio/fread.c b/newlib/libc/stdio/fread.c index fa3873075..e0faa3578 100644 --- a/newlib/libc/stdio/fread.c +++ b/newlib/libc/stdio/fread.c @@ -167,19 +167,15 @@ _DEFUN(fread, (buf, size, count, fp), fp->_bf._base = old_base; fp->_bf._size = old_size; fp->_p = old_p; - if (rc) - { - /* no more input: return partial result */ #ifdef __SCLE - if (fp->_flags & __SCLE) - { - _funlockfile (fp); - return crlf (fp, buf, total-resid, 1) / size; - } -#endif + if (fp->_flags & __SCLE) + { _funlockfile (fp); - return (total - resid) / size; + return crlf (fp, buf, total-resid, 1) / size; } +#endif + _funlockfile (fp); + return (total - resid) / size; } } else -- cgit v1.2.3