From a84a9b1819f9569715c6e6ebc0b2accdb8f12e23 Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sun, 7 Apr 2024 12:50:27 +0200 Subject: [PATCH] Resolved warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _fileno. --- src/os.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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")));