[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Win32] putenv modifications not inherited by child processed (Was:

From: Michael Goffioul
Subject: Re: [Win32] putenv modifications not inherited by child processed (Was: Heap corruption in putenv)
Date: Sat, 16 Feb 2013 02:28:34 +0000

On Fri, Feb 15, 2013 at 10:24 PM, Eric Blake <address@hidden> wrote:
On 02/15/2013 08:10 AM, Michael Goffioul wrote:
> The problem is that the "environ" variable is just a mirror of the
> environment that is manipulated through GetEnvironmentVariable and
> SetEnvironmentVariable. Manipulating the "environ" variable directly has no
> effect at the OS level and will only affect the current process (only calls
> to _putenv will actually propagate the changes through Win32 API). Child
> processes will not see the modified environment. Moreover even in the
> current process, I believe the values returned by GetEnvironmentVariable
> and "environ" (or getenv) will not be in sync.

How are you spawning your child processes?  Is it simple enough to wrap
all calls that create child processes so that those call sites iterate
through environ and shove it back into the OS level environment, so that
the child inherits the right thing, while not worrying about the OS
level environment for the rest of the process?

As far as I know, it uses  'system' call. But what you suggest would not resolve the incompatibility with Win32 API. It would be fine if all code that is linked with octave was also using gnulib, but that is not guaranteed.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]