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 <[email protected]>
    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.

_______________________________________________
Nut-upsdev mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsdev

Reply via email to