Disallow fseek() optimization in internal read buffer, if pointer is moved by

seek. It means that beginning of read buffer becomes not the same as current
file position.
This commit is contained in:
ache 2001-10-23 22:48:00 +00:00
parent f9e1c31e42
commit 76a4ffc8e5

View File

@ -164,6 +164,11 @@ _sseek(fp, offset, whence)
errret = errno;
if (errno == 0)
errno = serrno;
if (errret == 0 && (offset != 0 || whence != SEEK_CUR))
/* Disallow fseek() optimization inside read buffer */
fp->_flags |= __SMOD;
/*
* Disallow negative seeks per POSIX.
* It is needed here to help upper level caller