Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Oct 1998 14:15:57 +0100 (CET)
From:      Arjan de Vet <Arjan.deVet@adv.iae.nl>
To:        sthaug@nethelp.no
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Possible bug in freopen()?
Message-ID:  <199810311315.OAA16022@adv.iae.nl>
In-Reply-To: <17882.909826026@verdi.nethelp.no> from "sthaug@nethelp.no" at "Oct 31, 98 10:27:06 am"

next in thread | previous in thread | raw e-mail | index | archive | help
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              <Arjan.deVet@adv.iae.nl>
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



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