diff options
author | David Crawshaw <crawshaw@golang.org> | 2015-03-03 13:55:22 -0500 |
---|---|---|
committer | David Crawshaw <crawshaw@golang.org> | 2015-03-09 17:25:23 +0000 |
commit | 402f71a839e823c2ebad0b6524b17e07c03a6376 (patch) | |
tree | fd9f4a86a7f1d9b816bebc38e7a3bd4dec244024 /src/runtime/runtime.go | |
parent | ac080fa6d85ae848089b55144de0ce9dfc484d64 (diff) | |
download | go-402f71a839e823c2ebad0b6524b17e07c03a6376.tar.gz go-402f71a839e823c2ebad0b6524b17e07c03a6376.zip |
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>
Diffstat (limited to 'src/runtime/runtime.go')
-rw-r--r-- | src/runtime/runtime.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/runtime.go b/src/runtime/runtime.go index 6d32de2a4f..5f0ca02c0f 100644 --- a/src/runtime/runtime.go +++ b/src/runtime/runtime.go @@ -47,7 +47,7 @@ var envs []string var argslice []string //go:linkname syscall_runtime_envs syscall.runtime_envs -func syscall_runtime_envs() []string { return envs } +func syscall_runtime_envs() []string { return append([]string{}, envs...) } //go:linkname os_runtime_args os.runtime_args -func os_runtime_args() []string { return argslice } +func os_runtime_args() []string { return append([]string{}, argslice...) } |