HEADS UP: getenv() and family API change

Peter Jeremy peterjeremy at optushome.com.au
Tue Jul 10 21:36:04 UTC 2007


On 2007-Jul-10 19:41:48 +0400, Andrey Chernov <ache at nagual.pp.ru> wrote:
>To say strictly, copying somewhere is not neccessary since this way works 
>too:
>
>static char *s = "PATH=/bin";
>
>putenv(s);

I thought the C compiler was still free to place the string into RO
memory and/or coalesce it with other strings in that case.

Wouldn't the following be clearer (s is forced to be writable):

static char s[] = "PATH=/bin";

putenv(s);

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20070710/358e84e3/attachment.pgp


More information about the freebsd-current mailing list