Date: Fri, 03 May 1996 09:37:58 +0000 From: Poul-Henning Kamp <phk@critter.tfs.com> To: Josh MacDonald <jmacd@CS.Berkeley.EDU> Cc: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch), freebsd-hackers@freebsd.org Subject: Re: stdio problem Message-ID: <1597.831116278@critter.tfs.com> In-Reply-To: Your message of "Thu, 02 May 1996 15:20:21 MST." <199605022220.PAA17967@paris.CS.Berkeley.EDU>
next in thread | previous in thread | raw e-mail | index | archive | help
> Unfortunatly, I don't have control over this condition. I am closing
> the standard input and exec-ing GNU diff3. Diff3 calls freopen.
> The comments in stdio/freopen.c say this should work. It works everywhere
> else.
You are fully in control, you're the one that closes stdin!
> Your answers are not very helpful.
>
> Why couldn't you all just answer my questions instead of telling me
> it is wrong. Obviously, I already know that
> it doesn't work on FreeBSD or NetBSD, and that it works on every other
> operating system I've tried it on.
Hey, we're only trying to help you here, this attitude will not help much...
> a) Why does freopen fail *even though the comments in freopen.c say
> it should not*?
because something else could be occupying fd==0.
> b) Should GNU diff3 be responsible for checking that stdin is open
> before tring to freopen?
no.
> c) Should I not exec a program without an opened stdin? Programs
> which assume they have an open stdin are bad, I think.
No, they are not. if you want to get rid of whatever you have on
stdin, then do a
freopen("/dev/null", "r", stdin);
--
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?1597.831116278>
