Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Jul 2007 02:40:53 +0400
From:      Andrey Chernov <ache@nagual.pp.ru>
To:        "Sean C. Farley" <scf@FreeBSD.org>
Cc:        freebsd-current <freebsd-current@FreeBSD.org>
Subject:   Re: Environment handling broken in /bin/sh with changes to t,set,put}env()
Message-ID:  <20070713224053.GA21695@nagual.pp.ru>
In-Reply-To: <20070713152644.I26096@thor.farley.org>
References:  <20070707131359.GB96605@nagual.pp.ru> <20070707133102.C14065@thor.farley.org> <20070707191835.GA4368@nagual.pp.ru> <20070707205410.B14065@thor.farley.org> <20070708020940.GA80166@nagual.pp.ru> <20070708171727.GA90490@nagual.pp.ru> <20070713162742.GA16260@nagual.pp.ru> <20070713142545.K26096@thor.farley.org> <20070713202433.GA19856@nagual.pp.ru> <20070713152644.I26096@thor.farley.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jul 13, 2007 at 05:15:37PM -0500, Sean C. Farley wrote:
> Well technically, for setenv() and unsetenv() (the Open Group):
> 
>     If the application modifies environ or the pointers to which it
>     points, the behavior of unsetenv() is undefined.
> 
> However, I would like to have *env() functions work in this case.

It seems that anybody will agree with that.

> I chose #3.  Try the patch[1] again.  It creates a setenv() function
> which is a wrapper around __setenv().  __setenv() takes the lengths of
> name and value to allow the caller to calculate the length using pointer
> arithmetic instead of strlen().
> 
> Sean
>   1. http://www.farley.org/freebsd/tmp/setenv/clearenv/patch

The wrapper version finally looks OK for me.

-- 
http://ache.pp.ru/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070713224053.GA21695>