From 1f1e739ef21f8c63ebb997f935b3a4e34dbf2da1 Mon Sep 17 00:00:00 2001 From: Qi Xiao Date: Sun, 21 Feb 2016 16:20:01 +0100 Subject: [PATCH] sys: Fix error reporting of Tcsetgrp. --- sys/tc.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/tc.go b/sys/tc.go index 9c25da47..ba82d23b 100644 --- a/sys/tc.go +++ b/sys/tc.go @@ -2,18 +2,23 @@ package sys /* #include +#include int f(int fd, pid_t pid) { return tcsetpgrp(fd, pid); } + +int e() { + return errno; +} */ import "C" import "syscall" func Tcsetpgrp(fd int, pid int) error { - i := syscall.Errno(C.f(C.int(fd), C.pid_t(pid))) + i := C.f(C.int(fd), C.pid_t(pid)) if i != 0 { - return syscall.Errno(i) + return syscall.Errno(C.e()) } return nil }