diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-02-14 19:36:31 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-02-14 19:36:31 +0000 |
commit | ff902caea508c708075f166f365e327695064842 (patch) | |
tree | d141e2b8f5bbcb23f5f627e341aad3a1edc52b73 /libgo | |
parent | 33d9dbfa6e9e3c64010aa977cc2c74fdb0b02542 (diff) | |
download | gcc-ff902caea508c708075f166f365e327695064842.tar.gz |
syscall: Change Dup2 to only return an error.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184222 138bc75d-0d04-0410-961f-82ee72b054a4
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 9ef3eb00652..68143536182 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 98dbeb27750..cc3cfdb0805 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 75f0f45adaf..49441f8e1c4 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 414b8ed2d44..1226c1cfbd4 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) |