public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Setenv/putenv changes break existing code.
@ 1999-08-02 18:01 H.J. Lu
  1999-08-02 18:40 ` Ulrich Drepper
  1999-08-02 18:48 ` Geoff Keating
  0 siblings, 2 replies; 5+ messages in thread
From: H.J. Lu @ 1999-08-02 18:01 UTC (permalink / raw)
  To: GNU C Library

Hi,

The recent setenv/putenv change break existing code like:

	p = malloc (100);
	.....
	putenv (p);
	free (p);

sice p is used directly in putenv. However, from the Unix standard:

The putenv() function uses the string argument to set environment
variable values. The string argument should point to a string of the
form "name=value". The putenv() function makes the value of the
environment variable name equal to value by altering an existing
variable or creating a new one. In either case, the string pointed to
by string becomes part of the environment, so altering the string will
change the environment. The space used by string is no longer used
once a new string-defining name is passed to putenv(). 

It seems to me that it is ok to free 'p' since it is no longer used
when returning from putenv ().

This change breaks gdm. I don't know if anything else is broken.


-- 
H.J. Lu (hjl@gnu.org)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1999-08-03 16:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-02 18:01 Setenv/putenv changes break existing code H.J. Lu
1999-08-02 18:40 ` Ulrich Drepper
1999-08-03 16:08   ` Cristian Gafton
1999-08-03 16:19     ` Ulrich Drepper
1999-08-02 18:48 ` Geoff Keating

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).