From owner-freebsd-hackers Thu May 2 22:51:50 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id WAA01778 for hackers-outgoing; Thu, 2 May 1996 22:51:50 -0700 (PDT) Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id WAA01760 for ; Thu, 2 May 1996 22:51:40 -0700 (PDT) Received: from sax.sax.de by irz301.inf.tu-dresden.de (8.6.12/8.6.12-s1) with ESMTP id HAA17014; Fri, 3 May 1996 07:50:59 +0200 Received: by sax.sax.de (8.6.11/8.6.12-s1) with UUCP id HAA05742; Fri, 3 May 1996 07:50:57 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.7.5/8.6.9) id HAA17445; Fri, 3 May 1996 07:39:06 +0200 (MET DST) From: J Wunsch Message-Id: <199605030539.HAA17445@uriah.heep.sax.de> Subject: Re: stdio problem To: freebsd-hackers@freebsd.org (FreeBSD hackers) Date: Fri, 3 May 1996 07:39:06 +0200 (MET DST) Cc: jmacd@CS.Berkeley.EDU Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <199605022332.QAA00955@Root.COM> from David Greenman at "May 2, 96 04:32:31 pm" X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E X-Mailer: ELM [version 2.4ME+ PL15 (25)] 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 As David Greenman wrote: > As Joerg > pointed out, mixing streams oriented file operations (which are managed by > libc) with underlying file primitives is a no-no and will result in strange > and/or undefined behavior. I do agree, however, that freopen() should work > even if the file was close()'d. It does seem as though there is an issue with > flushing the stream buffers after the file has been closed, however. I also agree with this now, i didn't get it in the first place that the problem arose by mixing low-level IO and stdio across an exec(). I think stdio should not make any particular assumptions about the initial state of the file descriptors 0, 1, and 2 at the time of program startup. (Though this is perhaps hard to do correctly for all weird cases.) -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)