diff options
Diffstat (limited to 'vendor/modernc.org/libc/libc_freebsd.go')
| -rw-r--r-- | vendor/modernc.org/libc/libc_freebsd.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/vendor/modernc.org/libc/libc_freebsd.go b/vendor/modernc.org/libc/libc_freebsd.go index 0da77b0ab..d177340ce 100644 --- a/vendor/modernc.org/libc/libc_freebsd.go +++ b/vendor/modernc.org/libc/libc_freebsd.go @@ -921,7 +921,23 @@ func Xfileno(t *TLS, stream uintptr) int32 { if __ccgo_strace { trc("t=%v stream=%v, (%v:)", t, stream, origin(2)) } - panic(todo("")) + if stream == 0 { + if dmesgs { + dmesg("%v: FAIL", origin(1)) + } + t.setErrno(errno.EBADF) + return -1 + } + + if fd := int32((*stdio.FILE)(unsafe.Pointer(stream)).F_file); fd >= 0 { + return fd + } + + if dmesgs { + dmesg("%v: FAIL", origin(1)) + } + t.setErrno(errno.EBADF) + return -1 } func newCFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscallErrno) uintptr { |
