1
0
mirror of https://github.com/golang/go synced 2024-11-25 04:07:55 -07:00

misc/dist: don't lose mode bits when setting tar permissions

R=golang-dev, bsiegert, rsc
CC=golang-dev
https://golang.org/cl/5822046
This commit is contained in:
Brad Fitzpatrick 2012-03-14 08:24:11 -07:00
parent 5c8e88d6d2
commit d6ea81e0b9

View File

@ -546,11 +546,11 @@ func makeTar(targ, workdir string) error {
hdr.Uid = 0
hdr.Gid = 0
// Force mode to 0755 for executables, 0644 for everything else.
if hdr.Mode&0111 != 0 {
hdr.Mode = 0755
// Force permissions to 0755 for executables, 0644 for everything else.
if fi.Mode().Perm()&0111 != 0 {
hdr.Mode = hdr.Mode&^0777 | 0755
} else {
hdr.Mode = 0644
hdr.Mode = hdr.Mode&^0777 | 0644
}
err = tw.WriteHeader(hdr)