mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
syscall: make linux Dup2 match other systems
You could argue for changing all the others, but Linux is outvoted, and the only time it matters is when newfd==-1, in which case you can call Dup. R=golang-dev, r CC=golang-dev https://golang.org/cl/5650073
This commit is contained in:
parent
878153682e
commit
65ba8ee07e
4 changed files with 7 additions and 10 deletions
|
|
@ -210,9 +210,8 @@ func Dup(oldfd int) (fd int, err error) {
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup2(oldfd int, newfd int) (fd int, err error) {
|
||||
r0, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
|
||||
fd = int(r0)
|
||||
func Dup2(oldfd int, newfd int) (err error) {
|
||||
_, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue