From 751fc77994897c98526afeeab200b22c4555467a Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Tue, 23 Oct 2001 22:48:00 +0000 Subject: 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. --- lib/libc/stdio/stdio.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/libc/stdio/stdio.c') diff --git a/lib/libc/stdio/stdio.c b/lib/libc/stdio/stdio.c index 4bee60804d4a..c0860ebaded2 100644 --- a/lib/libc/stdio/stdio.c +++ b/lib/libc/stdio/stdio.c @@ -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 -- cgit v1.2.3