From 3bffb5f3064b129941a2cf6f459aeb85e8469ea7 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 29 Oct 2011 07:12:09 +0000 Subject: [PATCH] * 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 --- ChangeLog | 4 ++++ ext/sdbm/_sdbm.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index fd015593cd..98397912f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sat Oct 29 16:11:34 2011 Tanaka Akira + + * ext/sdbm/_sdbm.c (sdbm_prep): use O_CLOEXEC if available. + Sat Oct 29 14:26:56 2011 Tanaka Akira * io.c (rb_cloexec_open): use O_CLOEXEC if available. diff --git a/ext/sdbm/_sdbm.c b/ext/sdbm/_sdbm.c index 9b1cef45b0..c348808d31 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;