sys: Fix error reporting of Tcsetgrp.

This commit is contained in:
Qi Xiao 2016-02-21 16:20:01 +01:00
parent 4c0919b130
commit 1f1e739ef2

View File

@ -2,18 +2,23 @@ package sys
/*
#include <unistd.h>
#include <errno.h>
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
}