Skip to content

Commit

Permalink
runtime: leave directory before removing it in TestDLLPreloadMitigation
Browse files Browse the repository at this point in the history
Fixes #15120

Change-Id: I1d9a192ac163826bad8b46e8c0b0b9e218e69570
Reviewed-on: https://go-review.googlesource.com/21520
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/21698
Run-TryBot: Andrew Gerrand <adg@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
  • Loading branch information
alexbrainman authored and adg committed Apr 8, 2016
1 parent 16c4204 commit 6f643ce
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/runtime/syscall_windows_test.go
Expand Up @@ -780,6 +780,17 @@ func TestDLLPreloadMitigation(t *testing.T) {
t.Skip("skipping test: gcc is missing")
}

tmpdir, err := ioutil.TempDir("", "TestDLLPreloadMitigation")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
defer func() {
err := os.RemoveAll(tmpdir)
if err != nil {
t.Error(err)
}
}()

dir0, err := os.Getwd()
if err != nil {
t.Fatal(err)
Expand All @@ -794,12 +805,6 @@ uintptr_t cfunc() {
SetLastError(123);
}
`
tmpdir, err := ioutil.TempDir("", "TestDLLPreloadMitigation")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
defer os.RemoveAll(tmpdir)

srcname := "nojack.c"
err = ioutil.WriteFile(filepath.Join(tmpdir, srcname), []byte(src), 0)
if err != nil {
Expand Down

0 comments on commit 6f643ce

Please sign in to comment.