cmd/dist: fix pprof permissions

When installing pprof into the tools directory, it needs to
have execute permissions on unix-like systems.

Fixes issues 3077.

R=golang-dev, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/5675095
This commit is contained in:
Bobby Powers 2012-02-21 16:49:30 -05:00 committed by Russ Cox
parent 2110fadd12
commit d36426995a
7 changed files with 31 additions and 26 deletions

9
src/cmd/dist/unix.c vendored
View file

@ -351,9 +351,10 @@ readfile(Buf *b, char *file)
close(fd);
}
// writefile writes b to the named file, creating it if needed.
// writefile writes b to the named file, creating it if needed. if
// exec is non-zero, marks the file as executable.
void
writefile(Buf *b, char *file)
writefile(Buf *b, char *file, int exec)
{
int fd;
@ -362,9 +363,11 @@ writefile(Buf *b, char *file)
fatal("create %s: %s", file, strerror(errno));
if(write(fd, b->p, b->len) != b->len)
fatal("short write: %s", strerror(errno));
if(exec)
fchmod(fd, 0755);
close(fd);
}
// xmkdir creates the directory p.
void
xmkdir(char *p)