aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/os_aix.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/os_aix.go')
-rw-r--r--src/runtime/os_aix.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/runtime/os_aix.go b/src/runtime/os_aix.go
index 66b4d94cf2..21f7cea908 100644
--- a/src/runtime/os_aix.go
+++ b/src/runtime/os_aix.go
@@ -361,12 +361,9 @@ func walltime() (sec int64, nsec int32) {
}
//go:nosplit
-func fcntl(fd, cmd, arg int32) int32 {
+func fcntl(fd, cmd, arg int32) (int32, int32) {
r, errno := syscall3(&libc_fcntl, uintptr(fd), uintptr(cmd), uintptr(arg))
- if int32(r) < 0 {
- return -int32(errno)
- }
- return int32(r)
+ return int32(r), int32(errno)
}
//go:nosplit
@@ -376,8 +373,10 @@ func closeonexec(fd int32) {
//go:nosplit
func setNonblock(fd int32) {
- flags := fcntl(fd, _F_GETFL, 0)
- fcntl(fd, _F_SETFL, flags|_O_NONBLOCK)
+ flags, _ := fcntl(fd, _F_GETFL, 0)
+ if flags != -1 {
+ fcntl(fd, _F_SETFL, flags|_O_NONBLOCK)
+ }
}
// sigPerThreadSyscall is only used on linux, so we assign a bogus signal