Re: HEADS UP: getenv() and family API change

From: Andrey Chernov <ache_at_nagual.pp.ru>
Date: Sun, 8 Jul 2007 18:59:16 +0400
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/
Received on Sun Jul 08 2007 - 12:59:46 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:13 UTC