From owner-freebsd-hackers Fri Oct 30 13:39:20 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA28075 for freebsd-hackers-outgoing; Fri, 30 Oct 1998 13:39:20 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from news.IAEhv.nl (news.IAEhv.nl [194.151.64.4]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA28070 for ; Fri, 30 Oct 1998 13:39:18 -0800 (PST) (envelope-from devet@adv.iae.nl) Received: (from uucp@localhost) by news.IAEhv.nl (8.8.8/8.8.8) with IAEhv.nl id WAA03571 for hackers@freebsd.org; Fri, 30 Oct 1998 22:39:16 +0100 (MET) (envelope-from devet@adv.iae.nl) Received: (from devet@localhost) by adv.iae.nl (8.8.8/8.8.6) id WAA13889 for hackers@freebsd.org; Fri, 30 Oct 1998 22:39:02 +0100 (CET) From: Arjan de Vet Message-Id: <199810302139.WAA13889@adv.iae.nl> Subject: Possible bug in freopen()? To: hackers@FreeBSD.ORG Date: Fri, 30 Oct 1998 22:39:02 +0100 (CET) X-Mailer: ELM [version 2.4ME+ PL30 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, I may have found a bug in freopen() while testing INN 2.2-stable. Consider the following program: #include #include main () { FILE *f, *g; long i; g = fopen("/tmp/test", "a"); f = freopen("/tmp/test", "a", g); i = ftell(f); printf("%d\n", i); fprintf(f, "test"); i = ftell(f); printf("%d\n", i); close(f); } Start with an empty /tmp/test file and run the program three times consecutively. The results on BSD/OS 3.0, FreeBSD 2.2.7-stable and Solaris 2.6 are: BSDI 3.0 FreeBSD 2.2.7 Solaris ----------------------------------------------------------------------------- 0 0 0 4 4 4 0 0 4 8 4 8 0 0 8 12 4 12 Hmm... Quite different. I think Solaris shows the correct behaviour. In each case /tmp/test contains "testtesttest" after the running the program three times. Arjan -- Arjan de Vet, Eindhoven, The Netherlands URL: http://www.iae.nl/users/devet/ for PGP key: finger devet@iae.nl To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message