mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-12 17:27:50 +08:00
sys: Fix error reporting of Tcsetgrp.
This commit is contained in:
parent
4c0919b130
commit
1f1e739ef2
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user