Change-Id: Ibeb00306ee8f038c11f261abd99c05324bf2ab51
Reviewed-on: https://go-review.googlesource.com/c/go/+/609837
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
//
// TODO(bcmills): Why do we believe that another users will be able to
// execute a binary in this directory? (It could be mounted noexec.)
- tempDir, err := os.MkdirTemp("", "TestDeathSignal")
- if err != nil {
- t.Fatalf("cannot create temporary directory: %v", err)
- }
- defer os.RemoveAll(tempDir)
+ tempDir := t.TempDir()
os.Chmod(tempDir, 0755)
tmpBinary := filepath.Join(tempDir, filepath.Base(os.Args[0]))
}
// Copy the test binary to a location that a non-root user can read/execute
- // after we drop privileges
- tempDir, err := os.MkdirTemp("", "TestSyscallNoError")
- if err != nil {
- t.Fatalf("cannot create temporary directory: %v", err)
- }
- defer os.RemoveAll(tempDir)
+ // after we drop privileges.
+ tempDir := t.TempDir()
os.Chmod(tempDir, 0755)
tmpBinary := filepath.Join(tempDir, filepath.Base(os.Args[0]))