1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

lib: Open tdb files with O_CLOEXEC

After an exec() the fd's don't make sense anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2021-05-07 07:32:37 +02:00 committed by Jeremy Allison
parent 87a0a20417
commit b619195689

View File

@ -20,6 +20,7 @@
*/ */
#include "replace.h" #include "replace.h"
#include "system/filesys.h"
#include "lib/util/dlinklist.h" #include "lib/util/dlinklist.h"
#include "lib/util/debug.h" #include "lib/util/debug.h"
#include "tdb_wrap.h" #include "tdb_wrap.h"
@ -100,6 +101,11 @@ static struct tdb_wrap_private *tdb_wrap_private_open(TALLOC_CTX *mem_ctx,
/* Doesn't fail, see talloc_pooled_object */ /* Doesn't fail, see talloc_pooled_object */
result->name = talloc_strdup(result, name); result->name = talloc_strdup(result, name);
/*
* TDB files don't make sense after execve()
*/
open_flags |= O_CLOEXEC;
result->tdb = tdb_open_ex(name, hash_size, tdb_flags, result->tdb = tdb_open_ex(name, hash_size, tdb_flags,
open_flags, mode, &lctx, NULL); open_flags, mode, &lctx, NULL);
if (result->tdb == NULL) { if (result->tdb == NULL) {