From owner-freebsd-stable Tue Oct 16 23: 8:31 2001 Delivered-To: freebsd-stable@freebsd.org Received: from maild.telia.com (maild.telia.com [194.22.190.101]) by hub.freebsd.org (Postfix) with ESMTP id 8F45637B401 for ; Tue, 16 Oct 2001 23:08:27 -0700 (PDT) Received: from d1o913.telia.com (d1o913.telia.com [195.252.44.241]) by maild.telia.com (8.11.6/8.11.6) with ESMTP id f9H68OP21564 for ; Wed, 17 Oct 2001 08:08:25 +0200 (CEST) Received: from ertr1013.student.uu.se (h185n2fls20o913.telia.com [212.181.163.185]) by d1o913.telia.com (8.8.8/8.8.8) with SMTP id IAA14062 for ; Wed, 17 Oct 2001 08:08:24 +0200 (CEST) Received: (qmail 74170 invoked by uid 1001); 17 Oct 2001 06:08:22 -0000 Date: Wed, 17 Oct 2001 08:08:22 +0200 From: Erik Trulsson To: freebsd-stable@FreeBSD.ORG Subject: Re: setenv() cores with NULL value [was Re: Gdm proplem on 4.4] Message-ID: <20011017080821.A71883@student.uu.se> Mail-Followup-To: freebsd-stable@FreeBSD.ORG References: <200110160353.f9G3rO728525@harmony.village.org> <20011016013834.E293@blossom.cjclark.org> <200110161002.f9GA2CA08544@shalimar.net.au> <15308.25432.608079.646993@nomad.yogotech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.22.1i Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Oct 17, 2001 at 01:40:13PM +1000, Greg Black wrote: > > And I think that all those printf() library functions that print > "(null)" instead of allowing a core dump are doing the wrong > thing too. It's wrong, so don't do it. According to the C standard printing "(null)" isn't *wrong* in this situation. Dereferencing a null pointer invokes undefined behaviour which means that as far as the standard is concerned the compiler/library may do whatever it wants. This includes but is not limited to: 1) Core dumping. 2) Printing "(null)". 3) Reformatting your hard drive. 4) Sending embarrasing love letters by email to your boss. 5) Making demons fly out of your nose. 6) All of the above at the same time. Of these 1) and 2) are by far the most common responses but all the others are (implicitly) allowed by the C standard. -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message