aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/buildid
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-11-21 21:24:57 -0500
committerCherry Zhang <cherryyz@google.com>2020-12-01 23:37:58 +0000
commit8cd35e00bd413e68e6b9ae6403aa4209fc89b90f (patch)
treebd2debc003629ffd189f229d37d9c9f13fdafaec /src/cmd/buildid
parent6f84993e90e7076427c1bd0aaebe4e10b764194a (diff)
downloadgo-8cd35e00bd413e68e6b9ae6403aa4209fc89b90f.tar.gz
go-8cd35e00bd413e68e6b9ae6403aa4209fc89b90f.zip
cmd/internal/buildid: update Mach-O code signature when rewriting buildid
As the code signature contains hashes of the entire file (except the signature itself), rewriting buildid will invalidate the signature. This CL makes it regenerate the signature when rewriting the buildid. It only does it when the file already has a code signature, with proper size (darwin/arm64 binaries generated by the Go linker should have). Updates #38485, #42684. Change-Id: I082d9e5808b0ee6a35f9c362d7262aadd9113c81 Reviewed-on: https://go-review.googlesource.com/c/go/+/272257 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/buildid')
-rw-r--r--src/cmd/buildid/buildid.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/buildid/buildid.go b/src/cmd/buildid/buildid.go
index 699d977950..8e02a7ae10 100644
--- a/src/cmd/buildid/buildid.go
+++ b/src/cmd/buildid/buildid.go
@@ -62,7 +62,7 @@ func main() {
return
}
- f, err = os.OpenFile(file, os.O_WRONLY, 0)
+ f, err = os.OpenFile(file, os.O_RDWR, 0)
if err != nil {
log.Fatal(err)
}