On Fri, Feb 15, 2013 at 2:10 PM, Paul Eggert <egg...@cs.ucla.edu> wrote:

> On 02/15/2013 07:10 AM, Michael Goffioul wrote:
> > I guess the only solution to this problem is to always _putenv and not
> manipulate "environ" directly.
>
> Thanks, is that something you can write and contribute
> to the GNU project?  This sort of thing really requires
> Microsoft expertise, which I don't have.
>

I can give it a try, but not before a couple of days. Also to avoid
breaking things, what is the putenv module supposed to solve? From what I
understand, it is:
- make putenv("VARNAME") remove VARNAME from the environment
- make putenv("VARNAME=") create and empty environment variable
Is there anything else?

Reading the specs here [1], I don't think the bit: "In either case, the
string pointed to by *string* shall become part of the environment, so
altering the string shall change the environment." is actually possible. I
believe _putenv ultimately calls SetEnvironmentVariable [2] and nothing
there says that altering the given string will effectively alter the
environment.

Michael.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/putenv.html
[2]
http://msdn.microsoft.com/en-us/library/windows/desktop/ms686206(v=vs.85).aspx

Reply via email to