]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: join with TMPDIR more carefully to avoid // in path.
authorDavid Symonds <dsymonds@golang.org>
Mon, 19 Aug 2013 01:11:27 +0000 (11:11 +1000)
committerDavid Symonds <dsymonds@golang.org>
Mon, 19 Aug 2013 01:11:27 +0000 (11:11 +1000)
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

src/cmd/dist/unix.c

index 4a4feeb06455c63f319a3d998d1f1085d1f21476..0011e2f278afbf9e2ce5ef5a76dcd2860f8580dd 100644 (file)
@@ -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));