From owner-cvs-all Sun Sep 2 20:57:18 2001 Delivered-To: cvs-all@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id 5BF3937B405; Sun, 2 Sep 2001 20:57:10 -0700 (PDT) Received: (from ache@localhost) by nagual.pp.ru (8.11.6/8.11.6) id f833v8A98216; Mon, 3 Sep 2001 07:57:09 +0400 (MSD) (envelope-from ache) Date: Mon, 3 Sep 2001 07:57:07 +0400 From: "Andrey A. Chernov" To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/lib/libc/stdio fopen.c fseek.c Message-ID: <20010903075707.B98027@nagual.pp.ru> References: <200109022122.f82LM0G99109@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200109022122.f82LM0G99109@freefall.freebsd.org> User-Agent: Mutt/1.3.21i Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, Sep 02, 2001 at 14:22:00 -0700, Andrey A. Chernov wrote: > ache 2001/09/02 14:22:00 PDT > > Modified files: > lib/libc/stdio fopen.c fseek.c > Log: > Internal seeks are overoptimized. They should remember fp->_offset only for > plain regular files, i.e. files with __SOPT flag set. Fix it, so ftell(stdout) > always returns the same as lseek(1, 0, 1) now. > > NOTE: this bug was in original stdio code Try this test program on some old system stdio and with my changes, and see the differences: ----------------------------------------- #include main() { long i1, i2; i1 = ftell(stdout); system("/bin/echo 123"); i2 = ftell(stdout); printf("%ld %ld\n", i1, i2); } ----------------------------------------- Of course, you (or somebody else) can say that stdio needs to keep/tell its internal position only, but as you notice first ftell() with old and new stdio both tells absolute stdout position, i.e. some big number (if it suppose to tell stdio internal position instead, there must be 0). -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message