cmd/dist: defend self against misc/reboot test

Change-Id: Ice89ecae980d46b16b5ed32ac733bd23c92115af
Reviewed-on: https://go-review.googlesource.com/c/go/+/310870
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Russ Cox 2021-04-16 17:30:12 -04:00
parent 02a2ff47ef
commit b65f8589e8

View file

@ -249,6 +249,7 @@ func writefile(text, file string, flag int) {
if flag&writeExec != 0 {
mode = 0777
}
xremove(file) // in case of symlink tricks by misc/reboot test
err := ioutil.WriteFile(file, new, mode)
if err != nil {
fatalf("%v", err)