From ca2cadb1c63a3e9be3fa328778441a14319d87bd Mon Sep 17 00:00:00 2001 From: vitaut Date: Wed, 6 May 2015 07:19:42 -0700 Subject: [PATCH] Fix compilation when fileno is a macro This can happen on broken versions of MinGW. --- test/posix-test.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/posix-test.cc b/test/posix-test.cc index e3061240..453b3bb4 100644 --- a/test/posix-test.cc +++ b/test/posix-test.cc @@ -177,7 +177,11 @@ int test::fclose(FILE *stream) { int (test::fileno)(FILE *stream) { EMULATE_EINTR(fileno, -1); +#ifdef fileno + return FMT_POSIX(fileno(stream)); +#else return ::FMT_POSIX(fileno(stream)); +#endif } #ifndef _WIN32 @@ -433,7 +437,7 @@ TEST(BufferedFileTest, FilenoNoRetry) { File::pipe(read_end, write_end); BufferedFile f = read_end.fdopen("r"); fileno_count = 1; - EXPECT_SYSTEM_ERROR(f.fileno(), EINTR, "cannot get file descriptor"); + EXPECT_SYSTEM_ERROR((f.fileno)(), EINTR, "cannot get file descriptor"); EXPECT_EQ(2, fileno_count); fileno_count = 0; }