From: Jonathan Rudenberg Date: Mon, 29 Sep 2014 19:13:22 +0000 (-0700) Subject: cmd/ld: close outfile before cleanup X-Git-Tag: go1.4beta1~260 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e7e3b3ec1037669c90851670e2dc608b80d499d6;p=gostls13.git 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 --- 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