aboutsummaryrefslogtreecommitdiff
path: root/src/syscall/exec_linux.go
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2017-12-18 11:59:26 +0100
committerTobias Klauser <tobias.klauser@gmail.com>2018-02-13 15:57:31 +0000
commit36951a9f638b03950b7413eee73bd0e3ccf47130 (patch)
tree0ca42679f668f22178b3ae520638a36d54cb58dd /src/syscall/exec_linux.go
parentacd17e9b2b9740ea374ec18bcc7a4cd488eb534c (diff)
downloadgo-36951a9f638b03950b7413eee73bd0e3ccf47130.tar.xz
syscall: support syscalls without error return on Linux
Add the rawSyscallNoError wrapper function which is used for Linux syscalls that don't return an error and convert all applicable occurences of RawSyscall to use it instead. Fixes #22924 Change-Id: Iff1eddb54573d459faa01471f10398b3d38528dd Reviewed-on: https://go-review.googlesource.com/84485 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/syscall/exec_linux.go')
-rw-r--r--src/syscall/exec_linux.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go
index bfbe2b3d59..7ae3177fdc 100644
--- a/src/syscall/exec_linux.go
+++ b/src/syscall/exec_linux.go
@@ -122,7 +122,7 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att
)
// Record parent PID so child can test if it has died.
- ppid, _, _ := RawSyscall(SYS_GETPID, 0, 0, 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
@@ -219,10 +219,7 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att
if sys.Foreground {
pgrp := int32(sys.Pgid)
if pgrp == 0 {
- r1, _, err1 = RawSyscall(SYS_GETPID, 0, 0, 0)
- if err1 != 0 {
- goto childerror
- }
+ r1, _ = rawSyscallNoError(SYS_GETPID, 0, 0, 0)
pgrp = int32(r1)
}
@@ -311,9 +308,9 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att
// Signal self if parent is already dead. This might cause a
// duplicate signal in rare cases, but it won't matter when
// using SIGKILL.
- r1, _, _ = RawSyscall(SYS_GETPPID, 0, 0, 0)
+ r1, _ = rawSyscallNoError(SYS_GETPPID, 0, 0, 0)
if r1 != ppid {
- pid, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
+ pid, _ := rawSyscallNoError(SYS_GETPID, 0, 0, 0)
_, _, err1 := RawSyscall(SYS_KILL, pid, uintptr(sys.Pdeathsig), 0)
if err1 != 0 {
goto childerror