From owner-freebsd-stable Tue Oct 16 1:42: 9 2001 Delivered-To: freebsd-stable@freebsd.org Received: from harrier.mail.pas.earthlink.net (harrier.mail.pas.earthlink.net [207.217.121.12]) by hub.freebsd.org (Postfix) with ESMTP id DDA6A37B403 for ; Tue, 16 Oct 2001 01:42:06 -0700 (PDT) Received: from blossom.cjclark.org (dialup-209.244.104.182.Dial1.SanJose1.Level3.net [209.244.104.182]) by harrier.mail.pas.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id BAA28064; Tue, 16 Oct 2001 01:39:53 -0700 (PDT) Received: (from cjc@localhost) by blossom.cjclark.org (8.11.6/8.11.3) id f9G8con02880; Tue, 16 Oct 2001 01:38:50 -0700 (PDT) (envelope-from cjc) Date: Tue, 16 Oct 2001 01:38:34 -0700 From: "Crist J. Clark" To: Heath Nielson Cc: Warner Losh , David Marker , freebsd-stable@FreeBSD.ORG Subject: Re: setenv() cores with NULL value [was Re: Gdm proplem on 4.4] Message-ID: <20011016013834.E293@blossom.cjclark.org> Reply-To: cjclark@alum.mit.edu References: <200110160353.f9G3rO728525@harmony.village.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from heath@cs.byu.edu on Mon, Oct 15, 2001 at 10:57:26PM -0600 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 Mon, Oct 15, 2001 at 10:57:26PM -0600, Heath Nielson wrote: > On Mon, 15 Oct 2001, Warner Losh wrote: > > > In message Heath Nielson writes: > > : FreeBSD doesn't like a NULL value. There was no mention of NULL input > > : values in the man page. It seems that a NULL value is valid. I can type > > : export TEST= at the prompt without any errors, but I'm no shell expert. > > : Maybe the TEST env. variable's value isn't really NULL. Does anyone else > > : have anything to add to this? > > > > NULL isn't allowed to be passed to getenv. That is a programming > > error. You get unpredictable results. We nicely give you a core file > > so you can debug your error. > > > > Warner > > > > I was actually referring to setenv(). Upon further study, I guess it > boils down to a question of whether there's a difference between the two > calls: > > setenv("TEST1", "", 1); > setenv("TEST2", NULL, 1); A huge difference. In the first case, the second argument is a pointer aimed at a string which contains the bytes, '\0'. In the second case, we have a null pointer. Null pointers point at nothing. -- Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message