On Sat, 02 Oct 2010, Christos Zoulas wrote: > >I suggest a BUGS section in putenv(3) stating that that the interface > >uses non-const char* for compatibility with POSIX brain damage, but the > >implementation guarantees to treat it as read-only. > > Actually the string must be writeable because POSIX requires you > to use the actual string passed to putenv() inside the environment > array. All strings in the environment array must be writable.
If you mess with the environment using putenv(const string), then you should expect the relevant portion to no longer be writable by your program; but the implementation can still guarantee that none of the putenv/setenv/getenv functions will write to it. --apb (Alan Barrett)