diff --git a/src/os.cc b/src/os.cc index 70a4a04c4d3d3..253b8c4d8b4af 100644 --- a/src/os.cc +++ b/src/os.cc @@ -183,13 +183,9 @@ void buffered_file::close() { int buffered_file::descriptor() const { #ifdef FMT_HAS_SYSTEM - // fileno is a macro on OpenBSD. -# ifdef fileno -# undef fileno -# endif - int fd = FMT_POSIX_CALL(fileno(file_)); + int fd = FMT_POSIX_CALL(_fileno(file_)); #else - int fd = fileno(file_); + int fd = _fileno(file_); #endif if (fd == -1) FMT_THROW(system_error(errno, FMT_STRING("cannot get file descriptor")));