Commit ffeae198 authored by Alex Brainman's avatar Alex Brainman

runtime: leave directory before removing it in TestDLLPreloadMitigation

Fixes #15120

Change-Id: I1d9a192ac163826bad8b46e8c0b0b9e218e69570
Reviewed-on: https://go-review.googlesource.com/21520Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent c1c7547f
...@@ -780,6 +780,17 @@ func TestDLLPreloadMitigation(t *testing.T) { ...@@ -780,6 +780,17 @@ func TestDLLPreloadMitigation(t *testing.T) {
t.Skip("skipping test: gcc is missing") 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() dir0, err := os.Getwd()
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
...@@ -794,12 +805,6 @@ uintptr_t cfunc() { ...@@ -794,12 +805,6 @@ uintptr_t cfunc() {
SetLastError(123); SetLastError(123);
} }
` `
tmpdir, err := ioutil.TempDir("", "TestDLLPreloadMitigation")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
defer os.RemoveAll(tmpdir)
srcname := "nojack.c" srcname := "nojack.c"
err = ioutil.WriteFile(filepath.Join(tmpdir, srcname), []byte(src), 0) err = ioutil.WriteFile(filepath.Join(tmpdir, srcname), []byte(src), 0)
if err != nil { if err != nil {
......
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