I suspect the StdLib folks already know this but as a warning to the rest
of us, the getenv(3) in StdLib is reusing the character buffer in which it
returns values for each call to getenv(). The StdLib getenv comments say:
"The getenv function returns a pointer to a string associated with
the matched list member. The string pointed to shall not be
modified by the program, but may be overwritten by a subsequent
call to the getenv function. ..."
POSIX I believe defines something more like this:
"The getenv() function returns a pointer to the value in the environment..."
The later allows multiple calls to getenv() looking up different variables
to return distinct pointers to strings, the former returns the same pointer
over and over modifying the contents of the buffer ...
which btw, breaks Python startup code which essentially performs the
equivalent of:
...
char *rtpypath = getenv("PYTHONPATH");
char *path = getenv("PATH");
...
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel