From owner-freebsd-hackers Fri May 3 02:38:23 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id CAA15678 for hackers-outgoing; Fri, 3 May 1996 02:38:23 -0700 (PDT) Received: from tfs.com (tfs.com [140.145.250.1]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id CAA15673 for ; Fri, 3 May 1996 02:38:22 -0700 (PDT) Received: from critter.tfs.com by tfs.com (smail3.1.28.1) with SMTP id m0uFHJG-0003vpC; Fri, 3 May 96 02:37 PDT Received: from localhost (localhost [127.0.0.1]) by critter.tfs.com (8.7.5/8.6.12) with SMTP id JAA01599; Fri, 3 May 1996 09:38:00 GMT X-Authentication-Warning: critter.tfs.com: Host localhost [127.0.0.1] didn't use HELO protocol To: Josh MacDonald cc: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch), freebsd-hackers@freebsd.org Subject: Re: stdio problem In-reply-to: Your message of "Thu, 02 May 1996 15:20:21 MST." <199605022220.PAA17967@paris.CS.Berkeley.EDU> Date: Fri, 03 May 1996 09:37:58 +0000 Message-ID: <1597.831116278@critter.tfs.com> From: Poul-Henning Kamp Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > 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.