]> Cypherpunks repositories - gostls13.git/commit
cmd/go: check if destination is a regular file
authorMohit Agarwal <mohit@sdf.org>
Mon, 2 Nov 2015 18:34:46 +0000 (00:04 +0530)
committerIan Lance Taylor <iant@golang.org>
Wed, 4 Nov 2015 15:28:57 +0000 (15:28 +0000)
commit76811213d7f927c15220c91b4c47af7028af4f47
tree4c8ab71e70e0dae94ea4e8f0f402e5f1c39b495e
parent3a765430c18f993e291de14cc8d7803d95493fb8
cmd/go: check if destination is a regular file

builder.copyFile ensures that the destination is an object file.  This
wouldn't be true if we are not writing to a regular file and the copy
fails.  Check if the destination is an object file only if we are
writing to a regular file.  While removing the file, ensure that it is a
regular file so that device files and such aren't removed when running
as a user with suggicient privileges.

Fixes #12407

Change-Id: Ie86ce9770fa59aa56fc486a5962287859b69db3d
Reviewed-on: https://go-review.googlesource.com/16585
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/go/build.go
src/cmd/go/go_test.go