Fix set env() on MacOS X
Closed / Fixed524352ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 24 years ago
Descriptionplain2002-03-01 14:58:00
On MacOS X setting environment variables often failed if it required growing the environment space. The next array names, array get, or similar function would reset the environment variables back to an earlier set. Eg test with: set env(a) b array names env puts $env(a)
jkbonfield Ticket [524352ffff]: 1 change
[History diff]2002-03-01 21:58:43
jkbonfieldplain2002-03-01 22:01:03
Logged In: YES
user_id=154581
Sorry - I don't seem able to attach a file using IE on the
Mac. Don't know why. Anyway here's the patch:
*** tclEnv.c.orig Tue Feb 5 02:21:59 2002
--- tclEnv.c Fri Mar 1 14:52:08 2002
***************
*** 191,197 ****
if (index == -1) {
#ifndef USE_PUTENV
if ((length + 2) > environSize) {
! char **newEnviron;
newEnviron = (char **) ckalloc((unsigned)
((length + 5) * sizeof(char *)));
--- 191,197 ----
if (index == -1) {
#ifndef USE_PUTENV
if ((length + 2) > environSize) {
! char **newEnviron, ***e;
newEnviron = (char **) ckalloc((unsigned)
((length + 5) * sizeof(char *)));
***************
*** 202,207 ****
--- 202,209 ----
}
environ = newEnviron;
environSize = length + 5;
+ e = _NSGetEnviron();
+ *e = environ;
}
index = length;
environ[index + 1] = NULL;
davygrvyplain2002-03-13 17:18:08
Logged In: YES user_id=7549 excellent. Another call for splitting the [sg]etenv stuff into platform specific parts :)
dasplain2002-06-07 02:09:19
Logged In: YES user_id=90580 checked in a silightly improved patch adapted from this to the HEAD and core-8-3-1-branch
Log in (anonymous is fine) to add a comment.