Commit e7e3b3ec authored by Jonathan Rudenberg's avatar Jonathan Rudenberg Committed by Brad Fitzpatrick

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
parent e1364a6d
...@@ -531,8 +531,9 @@ char* mktempdir(void); ...@@ -531,8 +531,9 @@ char* mktempdir(void);
void removeall(char*); void removeall(char*);
static void static void
rmtemp(void) cleanup(void)
{ {
close(cout);
removeall(tmpdir); removeall(tmpdir);
} }
...@@ -547,7 +548,7 @@ hostlinksetup(void) ...@@ -547,7 +548,7 @@ hostlinksetup(void)
// create temporary directory and arrange cleanup // create temporary directory and arrange cleanup
if(tmpdir == nil) { if(tmpdir == nil) {
tmpdir = mktempdir(); tmpdir = mktempdir();
atexit(rmtemp); atexit(cleanup);
} }
// change our output to temporary object file // change our output to temporary object file
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment