From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2223 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Possible file stream bug Date: Fri, 26 Oct 2012 17:57:48 -0400 Message-ID: <20121026215748.GC254@brightrain.aerifal.cx> References: <20121024205904.GJ254@brightrain.aerifal.cx> <20121024212534.GL254@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1351288678 12359 80.91.229.3 (26 Oct 2012 21:57:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Oct 2012 21:57:58 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2224-gllmg-musl=m.gmane.org@lists.openwall.com Fri Oct 26 23:58:07 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1TRruo-0003yb-TF for gllmg-musl@plane.gmane.org; Fri, 26 Oct 2012 23:58:07 +0200 Original-Received: (qmail 12093 invoked by uid 550); 26 Oct 2012 21:57:58 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 12085 invoked from network); 26 Oct 2012 21:57:58 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2223 Archived-At: On Wed, Oct 24, 2012 at 11:54:17PM +0200, Paul Schutte wrote: > Thanks Rich ! > > I was thinking in terms of file descriptors which is only integers and not > whole data structures. > > Sorry for wasting your time. I committed some changes that weren't strictly needed, but which make the behavior "better" in programs which have called close(fileno(f)) prior to freopen(f, ...). These changes should also have the effect that the code in your example "works", but since it's using a FILE stream after calling fclose on it, relying on it continuing to work is not something I would recommend. It would be better to fix the buggy code. Rich