Skip to content

Commit

Permalink
Fix OpenBSD build error (#3295)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnZhong authored Feb 11, 2023
1 parent 655046d commit 3c5464b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/os.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3c5464b

Please sign in to comment.