mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
2110fadd12
commit
d36426995a
7 changed files with 31 additions and 26 deletions
9
src/cmd/dist/unix.c
vendored
9
src/cmd/dist/unix.c
vendored
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue