From: Volker Lendecke Date: Fri, 7 May 2021 05:32:37 +0000 (+0200) Subject: lib: Open tdb files with O_CLOEXEC X-Git-Tag: tevent-0.11.0~660 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6191956899d3a962dbddc19b39d509141774208;p=thirdparty%2Fsamba.git lib: Open tdb files with O_CLOEXEC After an exec() the fd's don't make sense anymore Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/lib/tdb_wrap/tdb_wrap.c b/lib/tdb_wrap/tdb_wrap.c index 864656f2047..49585aa0b9f 100644 --- a/lib/tdb_wrap/tdb_wrap.c +++ b/lib/tdb_wrap/tdb_wrap.c @@ -20,6 +20,7 @@ */ #include "replace.h" +#include "system/filesys.h" #include "lib/util/dlinklist.h" #include "lib/util/debug.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 */ 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, open_flags, mode, &lctx, NULL); if (result->tdb == NULL) {