From 59ebf79b48f749ce03da3f6f4964c55828aa2d4a Mon Sep 17 00:00:00 2001 From: ache Date: Sun, 2 Sep 2001 19:52:09 +0000 Subject: Fix bug in off_t overflow checking: if fp->_offset overflows, just remove __SOFF flag (i.e. we don't have offset) instead of returning EOVERFLOW. It allows again continious reading from non-stop stream. --- lib/libc/stdio/refill.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/stdio/refill.c b/lib/libc/stdio/refill.c index 2d30e81..19d98f9 100644 --- a/lib/libc/stdio/refill.c +++ b/lib/libc/stdio/refill.c @@ -142,17 +142,15 @@ __srefill(FILE *fp) if (fp->_r == 0) fp->_flags |= __SEOF; else { - err: fp->_r = 0; fp->_flags |= __SERR; fp->_flags &= ~__SOFF; } return (EOF); } else if (fp->_flags & __SOFF) { - if (fp->_offset > OFF_MAX - fp->_r) { - errno = EOVERFLOW; - goto err; - } else + if (fp->_offset > OFF_MAX - fp->_r) + fp->_flags &= ~__SOFF; + else fp->_offset += fp->_r; } return (0); -- cgit v1.1