On Mon, Jul 09, 2007 at 03:07:42PM -0500, Sean C. Farley wrote: > On Sun, 8 Jul 2007, Dirk Meyer wrote: > >> Hallo Sean C. Farley, >> >>> Changes in moving to POSIX from historic BSD API: >>> b. putenv takes a char * instead of const char *. >>> c. putenv no longer makes a copy of the input string. >> >> Can you give more details? >> >> An application will break in using this: >> putenv("PATH=/bin") >> >> now taking a char *, this will break with gcc42. > > True. As Andrey said, you should pass a copy of a const string into > putenv(). putenv() is designed to allow changing a value at any time by > manipulating the string. This is why I really wish the Open Group would To say strictly, copying somewhere is not neccessary since this way works too: static char *s = "PATH=/bin"; putenv(s); (don't forget static) -- http://ache.pp.ru/Received on Tue Jul 10 2007 - 13:42:29 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:14 UTC