Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 02 May 1996 14:11:36 +0000
From:      Poul-Henning Kamp <phk@critter.tfs.com>
To:        Josh MacDonald <jmacd@deceit.xcf.berkeley.edu>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: stdio problem 
Message-ID:  <3259.831046296@critter.tfs.com>
In-Reply-To: Your message of "Thu, 02 May 1996 01:58:26 MST." <199605020858.BAA05189@deceit.xcf.berkeley.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
>   close(0);
>   if(!freopen(argv[1], "r", stdin)) {

doing a "close(0)" is bound to confuse the stdio library.
don't do that.
freopen will close the filedesriptor and thud DTRT.

--
Poul-Henning Kamp           | phk@FreeBSD.ORG       FreeBSD Core-team.
http://www.freebsd.org/~phk | phk@login.dknet.dk    Private mailbox.
whois: [PHK]                | phk@ref.tfs.com       TRW Financial Systems, Inc.
Future will arrive by its own means, progress not so.



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