From owner-freebsd-current Sun Mar 31 0:30:17 2002 Delivered-To: freebsd-current@freebsd.org Received: from gatesrv.RZ.UniBw-Muenchen.de (gatesrv.RZ.UniBw-Muenchen.de [137.193.11.27]) by hub.freebsd.org (Postfix) with ESMTP id 6EDDE37B41C; Sun, 31 Mar 2002 00:30:12 -0800 (PST) Received: from nemesis.informatik.unibw-muenchen.de (nemesis.Informatik.UniBw-Muenchen.de [137.193.60.30]) by gatesrv.RZ.UniBw-Muenchen.de (8.11.2/8.11.2) with ESMTP id g2V86Oe29285; Sun, 31 Mar 2002 10:06:25 +0200 (MEST) Received: from localhost (localhost.informatik.unibw-muenchen.de [127.0.0.1]) by nemesis.informatik.unibw-muenchen.de (Postfix) with ESMTP id 848A35A547; Sun, 31 Mar 2002 10:06:23 +0200 (CEST) Received: by nemesis.informatik.unibw-muenchen.de (Postfix, from userid 1001) id 82A685A545; Sun, 31 Mar 2002 10:06:22 +0200 (CEST) Date: Sun, 31 Mar 2002 10:06:22 +0200 From: Oliver Braun To: Kris Kennaway Cc: "M. Warner Losh" , current@FreeBSD.ORG, peter@FreeBSD.ORG Subject: Re: stdout changes break some ports Message-ID: <20020331080622.GA95325@nemesis.informatik.unibw-muenchen.de> Mail-Followup-To: Oliver Braun , Kris Kennaway , "M. Warner Losh" , current@FreeBSD.ORG, peter@FreeBSD.ORG References: <20020324173513.A75429@xor.obsecurity.org> <20020324.184313.30925676.imp@village.org> <20020324175436.A75804@xor.obsecurity.org> <20020330224648.A93819@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020330224648.A93819@xor.obsecurity.org> User-Agent: Mutt/1.3.28i Organization: University of the Federal Armed Forces Munich, Germany X-Mailer: Mutt http://www.mutt.org/ X-OS: FreeBSD 4.5-STABLE i386 http://www.freebsd.org/ X-Newsreader: SLRN http://www.slrn.org/ X-Uptime: 9 days X-URL: http://ist.unibw-muenchen.de/People/obraun X-Accept-Language: de en X-Location: Europe, Germany, Munich X-Editor: Vim-601 http://www.vim.org/ X-Virus-Scanned: by AMaViS perl-11 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Kris Kennaway [2002-03-31 08:48]: > On Sun, Mar 24, 2002 at 05:54:36PM -0800, Kris Kennaway wrote: > > On Sun, Mar 24, 2002 at 06:43:13PM -0700, M. Warner Losh wrote: > > > > > : David O'Brien committed a workaround to the clog port yesterday to > > > : move the initializer to main() instead of trying to do it statically. > > > : > > > : Is this something which is supposed to work? > > > > > > No. This isn't something that is guaranteed to work per the > > > standards, iirc. The proper fix is to put the initializer in main. > > > > OK. Someone needs to go and fix those 84 ports then. > How does one fix this in a library? I've been moving the > initialization to main() for applications. Unfortunately it is not so straight forward. IMO, the best solution is to initialise to NULL and test for this when called and change them to stdin and stdout where necessary. This is a little overhead but the cleanest way IMO. I heard of the possibility to do things like static FILE*fpout=NULL; #define fp (fpout?fpout:stdout) But I never tested this. I can help you a little bit changing this in the concerning libraries, if you want, since this seems to be a lot of work. Regards, Olli -- Department of Computing Science Federal Armed Forces University Munich http://ist.unibw-muenchen.de/People/obraun/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message