X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f From: sandmann AT clio DOT rice DOT edu (Charles Sandmann) Message-Id: <10201111747.AA19446@clio.rice.edu> Subject: Re: frlist.c proposed patch To: eliz AT is DOT elta DOT co DOT il Date: Fri, 11 Jan 2002 11:47:07 -0600 (CST) Cc: djgpp-workers AT delorie DOT com In-Reply-To: <3099-Fri11Jan2002192635+0200-eliz@is.elta.co.il> from "Eli Zaretskii" at Jan 11, 2002 07:26:35 PM X-Mailer: ELM [version 2.5 PL2] Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > > Let's take a pathological case: > > 1) parent closes handles 1..4 (including stdout) > > 2) child opens a file, writes to it (it is assigned handle 1) > > 3) child prints to stdout() - it also goes to his file (uggh) and the > > buffers are all messed up > > That's _real_ pathological: no parent program in their right mind > should close stdout . Maybe so - but while changing code I think it's worth while discussing very similar problems that might come up. It could happen with stderr also. What about a buggy parent that accidentally closes a handle? Then you see strangeness in a child process that doesn't use that handle. > > So, when I do the stdout setup and notice that fileno(stdout) is not > > open - I'm saying I should change the file structure to cause failures > > instead of stomping on another file. > > Maybe just put some impossible number, like -1 or something, instead > of the handles in those FILE objects which are supposed to be > preconnected. This was my first thought, then I wondered if ANSI or POSIX had anything to say about it - and if so what we wanted to do about it.