mirror of
https://github.com/golang/go
synced 2024-11-19 03:44:40 -07:00
runtime: leave directory before removing it in TestDLLPreloadMitigation
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>
This commit is contained in:
parent
c1c7547f6a
commit
ffeae198d0
@ -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)
|
||||
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user