HEADS UP: getenv() and family API change
Andrey Chernov
ache at nagual.pp.ru
Sun Jul 8 14:59:47 UTC 2007
On Sun, Jul 08, 2007 at 04:13:49PM +0200, 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?
>
See POSIX description
http://www.opengroup.org/onlinepubs/009695399/functions/putenv.html
> An application will break in using this:
> putenv("PATH=/bin")
>
> now taking a char *, this will break with gcc42.
No break, this is illegal call (because this const _contents_ may be
changed with the yet one putenv call).
Why do you think gcc uses
tlink.c: putenv (xstrdup ("COMPILER_PATH="));
in its own internal code? (like many others)
--
http://ache.pp.ru/
More information about the freebsd-current
mailing list