Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Jul 2007 18:59:16 +0400
From:      Andrey Chernov <ache@nagual.pp.ru>
To:        Dirk Meyer <dirk.meyer@dinoex.sub.org>
Cc:        freebsd-current@freebsd.org
Subject:   Re: HEADS UP:  getenv() and family API change
Message-ID:  <20070708145916.GA88793@nagual.pp.ru>
In-Reply-To: <Xuu8UV3Bay@dmeyer.dinoex.sub.org>
References:  <20070703182400.Q1449@baba.farley.org> <Xuu8UV3Bay@dmeyer.dinoex.sub.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070708145916.GA88793>