summaryrefslogtreecommitdiff
path: root/port
diff options
context:
space:
mode:
authorAdam Azarchs <adam.azarchs@10xgenomics.com>2018-09-19 16:29:00 -0700
committerAdam Azarchs <adam.azarchs@10xgenomics.com>2019-02-22 13:00:56 -0800
commit75fceae7003e217e16b04433831da7528ae56881 (patch)
tree2a9f4389df93e28e20fef4df70e3ca3409f4fce6 /port
parentfe4494804f5e3a2e25485d32aeb0eb7d2f25732e (diff)
downloadleveldb-75fceae7003e217e16b04433831da7528ae56881.tar.gz
Add O_CLOEXEC to open calls.
This prevents file descriptors from leaking to child processes. When compiled for older (pre-2.6.23) kernels which lack support for O_CLOEXEC there is no change in behavior. With newer kernels, child processes will no longer inherit leveldb's file handles, which reduces the changes of accidentally corrupting the database. Fixes https://github.com/google/leveldb/issues/623
Diffstat (limited to 'port')
-rw-r--r--port/port_config.h.in5
1 files changed, 5 insertions, 0 deletions
diff --git a/port/port_config.h.in b/port/port_config.h.in
index d6a6d01..2127315 100644
--- a/port/port_config.h.in
+++ b/port/port_config.h.in
@@ -15,6 +15,11 @@
#cmakedefine01 HAVE_FULLFSYNC
#endif // !defined(HAVE_FULLFSYNC)
+// Define to 1 if you have a definition for O_CLOEXEC in <fcntl.h>.
+#if !defined(HAVE_O_CLOEXEC)
+#cmakedefine01 HAVE_O_CLOEXEC
+#endif // !defined(HAVE_O_CLOEXEC)
+
// Define to 1 if you have Google CRC32C.
#if !defined(HAVE_CRC32C)
#cmakedefine01 HAVE_CRC32C