Thread (10 messages) flat view 10 messages, 6 authors, 2016-06-15

Re: [BUG/PATCH] setup: Copy an environment variable to avoid overwrites

From: David Michael <hidden>
Date: 2016-06-15 22:55:39

Hi,

On Fri, Jan 4, 2013 at 8:17 PM, Junio C Hamano [off-list ref] wrote:
In fact,

    http://pubs.opengroup.org/onlinepubs/9699919799/functions/getenv.html

says that only setenv(), unsetenv() and putenv() may invalidate
previous return values.  Note that getenv() is not listed as a
function that is allowed to break return values from a previous call
to getenv().
Before I sent the e-mail, I checked that very page to be sure I wasn't
entirely insane.  Specifically, the second paragraph begins with:
The string pointed to may be overwritten by a subsequent call to getenv(), [...]
I read that line as confirmation that this is indeed acceptably
standard behavior.  Even the getenv man page on my Fedora workstation
says:
The string pointed to by the return value of getenv() may be statically allocated, and can be modified by a subsequent call to getenv(), putenv(3), setenv(3), or unsetenv(3).
Am I misinterpreting these statements?

Thanks.

David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help