summaryrefslogtreecommitdiff
path: root/src/cmd/ld
diff options
context:
space:
mode:
authorJonathan Rudenberg <jonathan@titanous.com>2014-09-29 12:13:22 -0700
committerJonathan Rudenberg <jonathan@titanous.com>2014-09-29 12:13:22 -0700
commitb9d1da5ff081d86d067779baf05868e2ef25edb4 (patch)
treef1a4734ef40c148819b0cfabd077bdf212c8e584 /src/cmd/ld
parentcb78dbdc80536773800a5671161df67d247e4085 (diff)
downloadgo-b9d1da5ff081d86d067779baf05868e2ef25edb4.tar.gz
cmd/ld: close outfile before cleanup
This prevents the temporary directory from being leaked when the linker is run on a FUSE filesystem. Fixes issue 8684. LGTM=bradfitz R=golang-codereviews, rsc, bradfitz CC=golang-codereviews https://codereview.appspot.com/141840043 Committer: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/cmd/ld')
-rw-r--r--src/cmd/ld/lib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c
index f889aba8a..910201bdb 100644
--- a/src/cmd/ld/lib.c
+++ b/src/cmd/ld/lib.c
@@ -531,8 +531,9 @@ char* mktempdir(void);
void removeall(char*);
static void
-rmtemp(void)
+cleanup(void)
{
+ close(cout);
removeall(tmpdir);
}
@@ -547,7 +548,7 @@ hostlinksetup(void)
// create temporary directory and arrange cleanup
if(tmpdir == nil) {
tmpdir = mktempdir();
- atexit(rmtemp);
+ atexit(cleanup);
}
// change our output to temporary object file