From 5c7a71bce0e0a284d388cbfca19564d568149f63 Mon Sep 17 00:00:00 2001 From: Chao Shi Date: Sun, 1 Oct 2023 09:34:38 +0800 Subject: [PATCH] Fix build break on system without O_CLOEXEC On system without O_CLOEXEC, HAVE_O_CLOEXEC is defined as 0 in include/port/port_config.h, not undefined. Therefore, the right way to test it is "#if HAVE_O_CLOEXEC" rather than "#if defined(...)". --- util/env_posix.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/env_posix.cc b/util/env_posix.cc index ffd06c4..b7d3824 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -50,11 +50,11 @@ constexpr const int kDefaultMmapLimit = (sizeof(void*) >= 8) ? 1000 : 0; int g_mmap_limit = kDefaultMmapLimit; // Common flags defined for all posix open operations -#if defined(HAVE_O_CLOEXEC) +#if HAVE_O_CLOEXEC constexpr const int kOpenBaseFlags = O_CLOEXEC; #else constexpr const int kOpenBaseFlags = 0; -#endif // defined(HAVE_O_CLOEXEC) +#endif // HAVE_O_CLOEXEC constexpr const size_t kWritableFileBufferSize = 65536;