Addition to prev. commit.

In some edge cases fp->_p can be changed in _sseek(), recalculate.

PR:     204156
MFC after:      1 week
This commit is contained in:
ache 2015-11-01 06:47:05 +00:00
parent 1b3f07327e
commit 135d0338a0

View File

@ -125,10 +125,6 @@ _ftello(FILE *fp, fpos_t *offset)
* underlying object.
*/
n = fp->_p - fp->_bf._base;
if (pos > OFF_MAX - n) {
errno = EOVERFLOW;
return (1);
}
if (n > 0 &&
((fp->_flags & __SAPP) || (fp->_flags2 & __S2OAP))) {
int serrno = errno;
@ -147,6 +143,12 @@ _ftello(FILE *fp, fpos_t *offset)
}
}
errno = serrno;
/* fp->_p can be changed in _sseek(), recalculate. */
n = fp->_p - fp->_bf._base;
}
if (pos > OFF_MAX - n) {
errno = EOVERFLOW;
return (1);
}
pos += n;
}