If lseek to wrong value sucessfully happens despite all pre-checks, set __SERR
to indicate that stream becomes inconsistent.
This commit is contained in:
parent
b13ed88361
commit
6946977c36
@ -297,6 +297,7 @@ _fseeko(fp, offset, whence, ltest)
|
||||
(*seekfn)(fp->_cookie, (fpos_t)offset, whence) == POS_ERR)
|
||||
return (-1);
|
||||
if (ltest && fp->_offset > LONG_MAX) {
|
||||
fp->_flags |= __SERR;
|
||||
errno = EOVERFLOW;
|
||||
return (-1);
|
||||
}
|
||||
|
@ -118,8 +118,10 @@ __sseek(cookie, offset, whence)
|
||||
* (fseek) in the cases it can't detect.
|
||||
*/
|
||||
if (ret < 0) {
|
||||
if (errret == 0)
|
||||
if (errret == 0) {
|
||||
fp->_flags |= __SERR;
|
||||
errno = EINVAL;
|
||||
}
|
||||
fp->_flags &= ~__SOFF;
|
||||
ret = -1;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user