aboutsummaryrefslogtreecommitdiff
path: root/src/syscall/exec_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/syscall/exec_linux.go')
-rw-r--r--src/syscall/exec_linux.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go
index 8b06760d16..14c13e273a 100644
--- a/src/syscall/exec_linux.go
+++ b/src/syscall/exec_linux.go
@@ -244,7 +244,7 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att
nextfd int
i int
caps caps
- fd1, flags uintptr
+ fd1, flags, ppid uintptr
puid, psetgroups, pgid []byte
uidmap, setgroups, gidmap []byte
clone3 *cloneArgs
@@ -278,7 +278,9 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att
}
// Record parent PID so child can test if it has died.
- ppid, _ := rawSyscallNoError(SYS_GETPID, 0, 0, 0)
+ if sys.Pdeathsig != 0 {
+ ppid, _ = rawSyscallNoError(SYS_GETPID, 0, 0, 0)
+ }
// Guard against side effects of shuffling fds below.
// Make sure that nextfd is beyond any currently open files so