From owner-cvs-lib Sat Nov 5 10:49:40 1994 Return-Path: cvs-lib-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.8/8.6.6) id KAA23189 for cvs-lib-outgoing; Sat, 5 Nov 1994 10:49:40 -0800 Received: (from nate@localhost) by freefall.cdrom.com (8.6.8/8.6.6) id KAA23179; Sat, 5 Nov 1994 10:49:36 -0800 Date: Sat, 5 Nov 1994 10:49:36 -0800 From: Nate Williams Message-Id: <199411051849.KAA23179@freefall.cdrom.com> To: CVS-commiters, cvs-lib Subject: cvs commit: src/lib/libc/stdio fseek.c Sender: cvs-lib-owner@FreeBSD.org Precedence: bulk nate 94/11/05 10:49:35 Modified: lib/libc/stdio fseek.c Log: Date: Wed, 26 Oct 1994 15:44:49 -0600 From: Chris Torek Here is a semi-official patch (apply to /usr/src/lib/libc/stdio/fseek.c, rebuild libc, install). The current code fails when the seek: - is optimized, and - is to just past the end of the block currently in the buffer, and - is followed by another seek with no intervening read operation, and - the destination of subsequent seek is within the block left in the buffer (seeking to the beginning of a block does not force a read, so the buffer still contains the previous block) so it is indeed rather obscure. I may have a different `final' fix, as this one `loses' the buffer contents on a seek that goes just past the end of the current block. [Footnote: seeks are optimized only on read-only opens of regular files that are buffered by the file's optimal I/O size. This is what you get with fopen(path, "r") and no call to setvbuf().] Obtained from: [ BSDI mailing list ]