diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-12-03 06:44:30 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-12-03 06:44:30 +0100 |
commit | 84c930a07894e30804469c32d84377b15868bfce (patch) | |
tree | 641b6adc9c4593d55810d1690f45e554d46f4d08 /sys/src/ape/lib/ap/plan9 | |
parent | eb9de925c63990f6b19494698e4db1eb9682e46d (diff) |
ape: fix putenv()
writing /env in putenv() doesnt work. exec will create
new enviroment anyway. we have to modify environ array!
Diffstat (limited to 'sys/src/ape/lib/ap/plan9')
-rw-r--r-- | sys/src/ape/lib/ap/plan9/_envsetup.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/src/ape/lib/ap/plan9/_envsetup.c b/sys/src/ape/lib/ap/plan9/_envsetup.c index 6a4f4204e..11f53dc81 100644 --- a/sys/src/ape/lib/ap/plan9/_envsetup.c +++ b/sys/src/ape/lib/ap/plan9/_envsetup.c @@ -45,11 +45,8 @@ _envsetup(void) fdinited = 0; cnt = 0; dfd = _OPEN("/env", 0); - if(dfd < 0) { - static char **emptyenvp = 0; - environ = emptyenvp; - return; - } + if(dfd < 0) + goto done; psize = Envhunk; ps = p = malloc(psize); nd = _dirreadall(dfd, &d9a); @@ -92,6 +89,7 @@ _envsetup(void) free(d9a); if(!fdinited) _fdinit(0, 0); +done: environ = pp = malloc((1+cnt)*sizeof(char *)); p = ps; for(i = 0; i < cnt; i++) { |