[Nut-upsdev] Environment Variables
Keven L. Ates
atescomp at gmail.com
Fri May 27 23:26:51 UTC 2011
On Fri, May 27, 2011 at 2:20 PM, Stuart D. Gathman <stuart at bmsi.com> wrote:
> On Fri, 27 May 2011, Keven L. Ates wrote:
>
> A problem I see with the above code is that the env checking function
>> appears to be called every time a variable is needed (see statepath
>> calls). This practice should probable be changed so that the env variable is
>> loaded
>> once at program startup and stored in a global var/struct and then used as
>> needed. This is so that changes to a env var within the programs runtime
>> context does not modify behavior or cause error, such as changing where it
>> looks for the PID file AFTER the PID file was created.
>>
>
> Under unix, at least, environment vars are copied to a process when it is
> created, and can only be changed by the process itself. So getenv()
> in effect *is* the global var/struct you want. Is Windows different
> in that regard?
>
> --
> Stuart D. Gathman <stuart at bmsi.com>
> Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
> "Confutatis maledictis, flammis acribus addictis" - background song for
> a Microsoft sponsored "Where do you want to go from here?" commercial.
>
That is generally the case, but then again people wish to do some odd
things:
http://stackoverflow.com/questions/205064/is-there-a-way-to-change-another-processs-environment-variables
Keven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20110527/ed544035/attachment.html>
More information about the Nut-upsdev
mailing list