aboutsummaryrefslogtreecommitdiff
path: root/src/gdbmreorg.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-11-11 18:39:42 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2011-11-11 18:39:42 +0000
commitbc12482932a6771566c7dcabc53f34e6297510f2 (patch)
treeb6f3f100201a5475fecdd1df66a45b1178831457 /src/gdbmreorg.c
parent894b78d5bcb7b609a3b52ce804306a63c4761282 (diff)
downloadgdbm-bc12482932a6771566c7dcabc53f34e6297510f2.tar.gz
gdbm-bc12482932a6771566c7dcabc53f34e6297510f2.tar.bz2
Implement cloexec in gdbm_reorganize. Add test cases.
* compat/dbmopen.c: Apply O_CLOEXEC for newly created dir file, if requested. * src/gdbmdefs.h (gdbm_file_info) <cloexec>: New member. * src/gdbmopen.c (gdbm_open): Initialize cloexec member. * src/gdbmreorg.c (gdbm_reorganize): Propagate cloexec bit to the new database. * tests/.cvsignore: Update. * tests/cloexec00.at: New test case. * tests/cloexec01.at: Likewise. * tests/cloexec02.at: Likewise. * tests/cloexec03.at: Likewise. * fdop.c: New auxiliary program. * g_open_ce: New test program. * g_reorg_ce: New test program. * d_creat_ce: New test program. * tests/Makefile.am: Add new test cases and test programs. * tests/testsuite.at: Include new test cases. * doc/gdbm.texinfo: Minor change.
Diffstat (limited to 'src/gdbmreorg.c')
-rw-r--r--src/gdbmreorg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gdbmreorg.c b/src/gdbmreorg.c
index 5fc0d68..cc2a929 100644
--- a/src/gdbmreorg.c
+++ b/src/gdbmreorg.c
@@ -102,7 +102,8 @@ gdbm_reorganize (GDBM_FILE dbf)
new_name[len] = '#';
/* Open the new database. */
- new_dbf = gdbm_open (new_name, dbf->header->block_size, GDBM_WRCREAT,
+ new_dbf = gdbm_open (new_name, dbf->header->block_size,
+ GDBM_WRCREAT | (dbf->cloexec ? GDBM_CLOEXEC : 0),
fileinfo.st_mode, dbf->fatal_err);
if (new_dbf == NULL)

Return to:

Send suggestions and report system problems to the System administrator.