summaryrefslogtreecommitdiff
path: root/ext/gdbm
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-11 12:14:23 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-11 12:14:23 +0000
commit268f6c3680ca5895630f92025a66ba67c2a0c7e2 (patch)
treeab4a5e4d50bb3d0fe7b35267a6cfd2230869c124 /ext/gdbm
parent266d09839b436b2ecc1d95456db4771b5a8119db (diff)
* ext/gdbm/gdbm.c (fgdbm_initialize): use GDBM_CLOEXEC if available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/gdbm')
-rw-r--r--ext/gdbm/gdbm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c
index 6364fc5807..6f0709e4ac 100644
--- a/ext/gdbm/gdbm.c
+++ b/ext/gdbm/gdbm.c
@@ -210,6 +210,11 @@ fgdbm_initialize(int argc, VALUE *argv, VALUE obj)
SafeStringValue(file);
+#ifdef GDBM_CLOEXEC
+ /* GDBM_CLOEXEC is implemented in gdbm 1.9.90 (development version after gdbm-1.9.1). */
+ flags |= GDBM_CLOEXEC;
+#endif
+
if (flags & RUBY_GDBM_RW_BIT) {
flags &= ~RUBY_GDBM_RW_BIT;
dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE,