summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-10-25 15:21:06 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-10-25 15:21:06 +0000
commit2a8460721ca219ea2d9bc00e0412297afd12df47 (patch)
tree610388e81e4b890ec99eb88c80ca40766bfc914b /base
parentcf81db320e518715ca6b8c6f6846dc50a2ad662a (diff)
parent32df7ee5c82a482f48c6df14ce3a77710cc0eb67 (diff)
downloadsystem_core-2a8460721ca219ea2d9bc00e0412297afd12df47.tar.gz
system_core-2a8460721ca219ea2d9bc00e0412297afd12df47.tar.bz2
system_core-2a8460721ca219ea2d9bc00e0412297afd12df47.zip
Merge "libbase: add O_CLOEXEC to <android-base/file.h>."
Diffstat (limited to 'base')
-rw-r--r--base/file.cpp1
-rw-r--r--base/include/android-base/file.h8
2 files changed, 7 insertions, 2 deletions
diff --git a/base/file.cpp b/base/file.cpp
index d6fe753d1..3834ed42a 100644
--- a/base/file.cpp
+++ b/base/file.cpp
@@ -38,7 +38,6 @@
#endif
#if defined(_WIN32)
#include <windows.h>
-#define O_CLOEXEC O_NOINHERIT
#define O_NOFOLLOW 0
#endif
diff --git a/base/include/android-base/file.h b/base/include/android-base/file.h
index 908690ba6..8f9bf80a0 100644
--- a/base/include/android-base/file.h
+++ b/base/include/android-base/file.h
@@ -21,11 +21,17 @@
#include <string>
#if !defined(_WIN32) && !defined(O_BINARY)
+/** Windows needs O_BINARY, but Unix never mangles line endings. */
#define O_BINARY 0
#endif
+#if defined(_WIN32) && !defined(O_CLOEXEC)
+/** Windows has O_CLOEXEC but calls it O_NOINHERIT for some reason. */
+#define O_CLOEXEC O_NOINHERIT
+#endif
+
#if defined(__APPLE__)
-/* Mac OS has always had a 64-bit off_t, so it doesn't have off64_t. */
+/** Mac OS has always had a 64-bit off_t, so it doesn't have off64_t. */
typedef off_t off64_t;
#endif