Re: Environment handling broken in /bin/sh with changes to t,set,put}env()

From: Andrey Chernov <ache_at_nagual.pp.ru>
Date: Sat, 14 Jul 2007 02:40:53 +0400
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/
Received on Fri Jul 13 2007 - 20:40:56 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:14 UTC