From owner-freebsd-hackers Sat Oct 31 05:16:19 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id FAA22980 for freebsd-hackers-outgoing; Sat, 31 Oct 1998 05:16:19 -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 FAA22975 for ; Sat, 31 Oct 1998 05:16:17 -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 OAA23955; Sat, 31 Oct 1998 14:16:12 +0100 (MET) (envelope-from devet@adv.iae.nl) Received: (from devet@localhost) by adv.iae.nl (8.8.8/8.8.6) id OAA16022; Sat, 31 Oct 1998 14:15:57 +0100 (CET) From: Arjan de Vet Message-Id: <199810311315.OAA16022@adv.iae.nl> Subject: Re: Possible bug in freopen()? In-Reply-To: <17882.909826026@verdi.nethelp.no> from "sthaug@nethelp.no" at "Oct 31, 98 10:27:06 am" To: sthaug@nethelp.no Date: Sat, 31 Oct 1998 14:15:57 +0100 (CET) Cc: hackers@FreeBSD.ORG 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 sthaug@nethelp.no: >Your program needs to fclose() the FILE :-) Aside from that, I believe Oops :-). >you definitely have a point. > >The FreeBSD freopen() behavior may actually be correct according to the >standards. My copy of POSIX 1003.1 (First edition, 1990-12-07) says the >following about ftell(): [...] >So freopen() behaving differently than fopen() may be allowed by the >standards - but it certainly violates POLA, and probably also the FreeBSD This behavior may be allowed but the FreeBSD version printed "4" for the last ftell() call after the fprintf() all three times, whereas BSD/OS and Solaris printed both 4, 8 and 12 (which is what I would expect). >Here is a proposed patch - it simply consists of the relevant part of the >fopen() function, inserted at the appropriate place in freopen(). Thanks, your patch fixes the problem. I just submitted a PR, with a pointer to this discussion. 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