libc: ftell should return position of read pointer

This commit is contained in:
K. Lange 2018-10-12 15:40:04 +09:00
parent 0df12ea064
commit f16fbd458c

View File

@ -313,6 +313,9 @@ long ftell(FILE * stream) {
if (_argv_0 && strcmp(_argv_0, "ld.so") && __libc_debug) {
fprintf(stderr, "%s: ftell(%s)\n", _argv_0, stream->_name);
}
if (stream->read_from || stream->last_read_start) {
return stream->last_read_start + stream->read_from;
}
stream->offset = 0;
stream->read_from = 0;
stream->available = 0;