From 3c5464ba1cbac7fa84009a5ec207977208be69e2 Mon Sep 17 00:00:00 2001 From: Shawn Zhong Date: Sat, 11 Feb 2023 10:46:28 -0600 Subject: [PATCH] Fix OpenBSD build error (#3295) --- src/os.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/os.cc b/src/os.cc index 75befaf5..d9b9d827 100644 --- a/src/os.cc +++ b/src/os.cc @@ -206,7 +206,11 @@ void buffered_file::close() { } int buffered_file::descriptor() const { +#ifdef fileno // fileno is a macro on OpenBSD so we cannot use FMT_POSIX_CALL. + int fd = fileno(file_); +#else int fd = FMT_POSIX_CALL(fileno(file_)); +#endif if (fd == -1) FMT_THROW(system_error(errno, FMT_STRING("cannot get file descriptor"))); return fd;