aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/ld
diff options
context:
space:
mode:
authorJonathan Rudenberg <jonathan@titanous.com>2014-09-29 12:13:22 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2014-09-29 12:13:22 -0700
commite7e3b3ec1037669c90851670e2dc608b80d499d6 (patch)
tree94bd1c0e20099f4a54c32f4237c335d917f494a3 /src/cmd/ld
parente1364a6d0ecd5ba50845f416bb3c016bc54a3648 (diff)
downloadgo-e7e3b3ec1037669c90851670e2dc608b80d499d6.tar.xz
cmd/ld: close outfile before cleanup
This prevents the temporary directory from being leaked when the linker is run on a FUSE filesystem. Fixes #8684. LGTM=bradfitz R=golang-codereviews, rsc, bradfitz CC=golang-codereviews https://golang.org/cl/141840043
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 f889aba8a9..910201bdbb 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