diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ext/gdbm/gdbm.c | 5 |
2 files changed, 9 insertions, 0 deletions
@@ -1,3 +1,7 @@ +Fri Nov 11 21:13:30 2011 Tanaka Akira <akr@fsij.org> + + * ext/gdbm/gdbm.c (fgdbm_initialize): use GDBM_CLOEXEC if available. + Fri Nov 11 21:00:05 2011 Tanaka Akira <akr@fsij.org> * ext/dbm/extconf.rb: fix dbm_pagfno and dbm_dirfno detection with 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, |