From 38881e5acfbac830bdf68ad1c101ae420ac5bc92 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 19 Mar 2024 10:30:06 +0900 Subject: [PATCH] Fix handling of the fileno macro --- src/os.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/os.cc b/src/os.cc index 7813c433..70a4a04c 100644 --- a/src/os.cc +++ b/src/os.cc @@ -182,12 +182,12 @@ void buffered_file::close() { } int buffered_file::descriptor() const { -#if !defined(fileno) +#ifdef FMT_HAS_SYSTEM + // fileno is a macro on OpenBSD. +# ifdef fileno +# undef fileno +# endif int fd = FMT_POSIX_CALL(fileno(file_)); -#elif defined(FMT_HAS_SYSTEM) - // fileno is a macro on OpenBSD so we cannot use FMT_POSIX_CALL. -# define FMT_DISABLE_MACRO - int fd = FMT_SYSTEM(fileno FMT_DISABLE_MACRO(file_)); #else int fd = fileno(file_); #endif