summaryrefslogtreecommitdiff
path: root/ext/sdbm/_sdbm.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-29 07:12:09 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-29 07:12:09 +0000
commit3bffb5f3064b129941a2cf6f459aeb85e8469ea7 (patch)
treed85a5cb611897f7255ddbb80d5ccf9e18bf538ec /ext/sdbm/_sdbm.c
parentbaa2d74daea424a7e28cf659e9d3a1fd05a7ff3e (diff)
* ext/sdbm/_sdbm.c (sdbm_prep): use O_CLOEXEC if available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/sdbm/_sdbm.c')
-rw-r--r--ext/sdbm/_sdbm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/sdbm/_sdbm.c b/ext/sdbm/_sdbm.c
index 9b1cef45b03..c348808d315 100644
--- a/ext/sdbm/_sdbm.c
+++ b/ext/sdbm/_sdbm.c
@@ -226,6 +226,9 @@ sdbm_prep(char *dirname, char *pagname, int flags, int mode)
* If we fail anywhere, undo everything, return NULL.
*/
flags |= O_BINARY;
+#ifdef O_CLOEXEC
+ flags |= O_CLOEXEC;
+#endif
if ((db->pagf = open(pagname, flags, mode)) == -1) goto err;
if (fd_set_cloexec(db->pagf) == -1) goto err;