diff options
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/go/syscall/exec_bsd.go | 13 | ||||
-rw-r--r-- | libgo/go/syscall/exec_linux.go | 15 | ||||
-rw-r--r-- | libgo/go/syscall/exec_unix.go | 3 | ||||
-rw-r--r-- | libgo/go/syscall/libcall_posix.go | 2 |
4 files changed, 15 insertions, 18 deletions
diff --git a/libgo/go/syscall/exec_bsd.go b/libgo/go/syscall/exec_bsd.go index 9ef3eb0..6814353 100644 --- a/libgo/go/syscall/exec_bsd.go +++ b/libgo/go/syscall/exec_bsd.go @@ -136,9 +136,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr // so that pass 2 won't stomp on an fd it needs later. nextfd = int(len(fd)) if pipe < nextfd { - _, err2 := Dup2(pipe, nextfd) - if err2 != nil { - err1 = err2.(Errno) + err1 = raw_dup2(pipe, nextfd) + if err1 != 0 { goto childerror } raw_fcntl(nextfd, F_SETFD, FD_CLOEXEC) @@ -147,9 +146,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr } for i = 0; i < len(fd); i++ { if fd[i] >= 0 && fd[i] < int(i) { - _, err2 := Dup2(fd[i], nextfd) - if err2 != nil { - err1 = err2.(Errno) + err1 = raw_dup2(fd[i], nextfd) + if err1 != 0 { goto childerror } raw_fcntl(nextfd, F_SETFD, FD_CLOEXEC) @@ -178,9 +176,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr } // The new fd is created NOT close-on-exec, // which is exactly what we want. - _, err2 := Dup2(fd[i], i) + err1 = raw_dup2(fd[i], i) if err1 != 0 { - err1 = err2.(Errno) goto childerror } } diff --git a/libgo/go/syscall/exec_linux.go b/libgo/go/syscall/exec_linux.go index 98dbeb2..cc3cfdb 100644 --- a/libgo/go/syscall/exec_linux.go +++ b/libgo/go/syscall/exec_linux.go @@ -161,9 +161,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr // so that pass 2 won't stomp on an fd it needs later. nextfd = int(len(fd)) if pipe < nextfd { - _, err2 := Dup2(pipe, nextfd) - if err2 != nil { - err1 = err2.(Errno) + err1 = raw_dup2(pipe, nextfd) + if err1 != 0 { goto childerror } raw_fcntl(nextfd, F_SETFD, FD_CLOEXEC) @@ -172,9 +171,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr } for i = 0; i < len(fd); i++ { if fd[i] >= 0 && fd[i] < int(i) { - _, err2 := Dup2(fd[i], nextfd) - if err2 != nil { - err1 = err2.(Errno) + err1 = raw_dup2(fd[i], nextfd) + if err1 != 0 { goto childerror } raw_fcntl(nextfd, F_SETFD, FD_CLOEXEC) @@ -203,9 +201,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr } // The new fd is created NOT close-on-exec, // which is exactly what we want. - _, err2 := Dup2(fd[i], i); - if err2 != nil { - err1 = err2.(Errno) + err1 = raw_dup2(fd[i], i) + if err1 != 0 { goto childerror } } diff --git a/libgo/go/syscall/exec_unix.go b/libgo/go/syscall/exec_unix.go index 75f0f45..49441f8 100644 --- a/libgo/go/syscall/exec_unix.go +++ b/libgo/go/syscall/exec_unix.go @@ -47,6 +47,9 @@ import ( //sysnb raw_exit(status int) //_exit(status int) +//sysnb raw_dup2(oldfd int, newfd int) (err Errno) +//dup2(oldfd int, newfd int) int + // Note: not raw, returns error rather than Errno. //sys read(fd int, p *byte, np int) (n int, err error) //read(fd int, buf *byte, count Size_t) Ssize_t diff --git a/libgo/go/syscall/libcall_posix.go b/libgo/go/syscall/libcall_posix.go index 414b8ed..1226c1c 100644 --- a/libgo/go/syscall/libcall_posix.go +++ b/libgo/go/syscall/libcall_posix.go @@ -178,7 +178,7 @@ func FDZero(set *FdSet) { //sysnb Dup(oldfd int) (fd int, err error) //dup(oldfd int) int -//sysnb Dup2(oldfd int, newfd int) (fd int, err error) +//sysnb Dup2(oldfd int, newfd int) (err error) //dup2(oldfd int, newfd int) int //sys Exit(code int) |