# --- T2-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # T2 SDE: package/.../dietlibc/putenv.patch # Copyright (C) 2006 The T2 SDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- T2-COPYRIGHT-NOTE-END --- For clearenv(). - Rene Rebe --- ./lib/putenv.c 19 Feb 2006 15:38:28 -0000 1.9 +++ ./lib/putenv.c 22 Jun 2006 14:13:24 -0000 @@ -2,6 +2,8 @@ #include #include +char **__origenv; /* also used by clearenv */ + int putenv(const char *string) { size_t len; int envc; @@ -9,8 +11,7 @@ char *tmp; const char **ep; char **newenv; - static char **origenv; - if (!origenv) origenv=environ; + if (!__origenv) __origenv=environ; if (!(tmp=strchr(string,'='))) { len=strlen(string); remove=1; @@ -29,11 +30,11 @@ ++envc; } if (tmp) { - newenv = (char**) realloc(environ==origenv?0:environ, + newenv = (char**) realloc(environ==__origenv?0:environ, (envc+2)*sizeof(char*)); if (!newenv) return -1; - if (envc && (environ==origenv)) { - memcpy(newenv,origenv,envc*sizeof(char*)); + if (envc && (environ==__origenv)) { + memcpy(newenv,__origenv,envc*sizeof(char*)); } newenv[envc]=(char*)string; newenv[envc+1]=0;