From owner-freebsd-hackers Thu May 2 21:43:44 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id VAA23929 for hackers-outgoing; Thu, 2 May 1996 21:43:44 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id VAA23924 for ; Thu, 2 May 1996 21:43:42 -0700 (PDT) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id VAA13496; Thu, 2 May 1996 21:35:37 -0700 From: Terry Lambert Message-Id: <199605030435.VAA13496@phaeton.artisoft.com> Subject: Re: stdio problem To: jmacd@CS.Berkeley.EDU (Josh MacDonald) Date: Thu, 2 May 1996 21:35:37 -0700 (MST) Cc: sclawson@bottles.cs.utah.edu, freebsd-hackers@FreeBSD.org In-Reply-To: <199605030320.UAA18744@paris.CS.Berkeley.EDU> from "Josh MacDonald" at May 2, 96 08:20:01 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk > Whether I do fclose(stdin) or close(STDIN_FILENO) makes no difference, > and in fact the same problem applies. I am execing another program > which then tries to freopen(...,...,stdin). Actually, it has to do with whether the state for the fd is valid. I think it ought to work under "the rule of least astonishment", but use of fclose instead of close is the correct course of action, since there is implied state for stdin, stdout, and stderr. If it fails with fclose() followed by freopen, then it's a bug, and it needs to be fixed. If it doesn't, and it only failes with close, then it's not technically an error, but is suprising to the user -- which is nearly as bad. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.