1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-27 16:39:08 +00:00

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.
This commit is contained in:
Andrey A. Chernov 2001-09-02 19:52:09 +00:00
parent 890bbd6bda
commit 778d840e50
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=82818

View File

@ -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);