From mboxrd@z Thu Jan 1 00:00:00 1970 From: hjl@lucon.org (H.J. Lu) To: libc-hacker@sourceware.cygnus.com (GNU C Library) Subject: Setenv/putenv changes break existing code. Date: Mon, 02 Aug 1999 18:01:00 -0000 Message-id: <19990803010000.E96D457BA@ocean.lucon.org> X-SW-Source: 1999-08/msg00005.html 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)