os: fix build issue caused by fileno on *BSD
parent
a3bd8d3e4c
commit
c7501e2d3d
|
@ -301,7 +301,11 @@ pub fn fileno(cfile voidptr) int {
|
|||
$if windows {
|
||||
return C._fileno(cfile)
|
||||
} $else {
|
||||
return C.fileno(cfile)
|
||||
cfile_casted := &C.FILE(0) // FILE* cfile_casted = 0;
|
||||
cfile_casted = cfile
|
||||
// Required on FreeBSD/OpenBSD/NetBSD as stdio.h defines fileno(..) with a macro
|
||||
// that performs a field access on its argument without casting from void*.
|
||||
return C.fileno(cfile_casted)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue