Date: Tue, 16 Oct 2001 01:38:34 -0700 From: "Crist J. Clark" <cristjc@earthlink.net> To: Heath Nielson <heath@cs.byu.edu> Cc: Warner Losh <imp@harmony.village.org>, David Marker <marker_d@yahoo.com>, 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> In-Reply-To: <Pine.LNX.4.33.0110152249220.8479-100000@organ.cs.byu.edu>; from heath@cs.byu.edu on Mon, Oct 15, 2001 at 10:57:26PM -0600 References: <200110160353.f9G3rO728525@harmony.village.org> <Pine.LNX.4.33.0110152249220.8479-100000@organ.cs.byu.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Oct 15, 2001 at 10:57:26PM -0600, Heath Nielson wrote:
> On Mon, 15 Oct 2001, Warner Losh wrote:
>
> > In message <Pine.LNX.4.33.0110151727300.6035-100000@organ.cs.byu.edu> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011016013834.E293>
