From: David Symonds Date: Mon, 19 Aug 2013 01:11:27 +0000 (+1000) Subject: cmd/dist: join with TMPDIR more carefully to avoid // in path. X-Git-Tag: go1.2rc2~501 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=24f302a69d80f2e89db81fad600165b2f857c193;p=gostls13.git cmd/dist: join with TMPDIR more carefully to avoid // in path. This might fix the mkdtemp problem on the darwin builders if they have TMPDIR set to a path ending in a slash; at worse this will result in cleaner path names. R=golang-dev, r CC=golang-dev https://golang.org/cl/13097043 --- diff --git a/src/cmd/dist/unix.c b/src/cmd/dist/unix.c index 4a4feeb064..0011e2f278 100644 --- a/src/cmd/dist/unix.c +++ b/src/cmd/dist/unix.c @@ -466,7 +466,9 @@ xworkdir(void) xgetenv(&b, "TMPDIR"); if(b.len == 0) bwritestr(&b, "/var/tmp"); - bwritestr(&b, "/go-cbuild-XXXXXX"); + if(b.p[b.len-1] != '/') + bwrite(&b, "/", 1); + bwritestr(&b, "go-cbuild-XXXXXX"); p = bstr(&b); if(mkdtemp(p) == nil) fatal("mkdtemp(%s): %s", p, strerror(errno));