[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: Possible bug in freopen()?
From:       Arjan de Vet <Arjan.deVet () adv ! iae ! nl>
Date:       1998-10-31 13:15:57
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic