Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Sep 2001 07:57:07 +0400
From:      "Andrey A. Chernov" <ache@nagual.pp.ru>
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>
In-Reply-To: <200109022122.f82LM0G99109@freefall.freebsd.org>
References:  <200109022122.f82LM0G99109@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <stdio.h>

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010903075707.B98027>