runtime: do not share underlying envs/argv array

Removes a potential data race between os.Setenv and runtime.GOROOT,
along with a bug where os.Setenv would only sometimes change the
value of runtime.GOROOT.

Change-Id: I7d2a905115c667ea6e73f349f3784a1d3e8f810d
Reviewed-on: https://go-review.googlesource.com/6611
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
David Crawshaw 2015-03-03 13:55:22 -05:00
parent ac080fa6d8
commit 402f71a839
3 changed files with 46 additions and 2 deletions

View file

@ -122,3 +122,6 @@ var Open = open
var Close = close
var Read = read
var Write = write
func Envs() []string { return envs }
func SetEnvs(e []string) { envs = e }