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;