diff options
Diffstat (limited to 'vendor/modernc.org/libc/ioutil_linux.go')
-rw-r--r-- | vendor/modernc.org/libc/ioutil_linux.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vendor/modernc.org/libc/ioutil_linux.go b/vendor/modernc.org/libc/ioutil_linux.go index 608857f21..db90f5598 100644 --- a/vendor/modernc.org/libc/ioutil_linux.go +++ b/vendor/modernc.org/libc/ioutil_linux.go @@ -43,7 +43,7 @@ func nextRandom(x uintptr) { copy((*RawMem)(unsafe.Pointer(x))[:6:6], fmt.Sprintf("%06d", int(1e9+r%1e9)%1e6)) } -func tempFile(s, x uintptr, flags int32) (fd, err int) { +func tempFile(s, x uintptr, flags int32) (fd int, err error) { const maxTry = 10000 nconflict := 0 flags |= int32(os.O_RDWR | os.O_CREATE | os.O_EXCL | unix.O_LARGEFILE) @@ -52,11 +52,11 @@ func tempFile(s, x uintptr, flags int32) (fd, err int) { fdcwd := fcntl.AT_FDCWD n, _, err := unix.Syscall6(unix.SYS_OPENAT, uintptr(fdcwd), s, uintptr(flags), 0600, 0, 0) if err == 0 { - return int(n), 0 + return int(n), nil } if err != errno.EEXIST { - return -1, int(err) + return -1, err } if nconflict++; nconflict > 10 { @@ -66,5 +66,5 @@ func tempFile(s, x uintptr, flags int32) (fd, err int) { randStateMu.Unlock() } } - return -1, errno.EEXIST + return -1, unix.Errno(errno.EEXIST) } |