X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=tdb%2Ftdb.c;h=e87ea3692eb555f2cea013cb94f98b14acd2cd0a;hb=da767d0739c86a04a0c0326cebff6c08ffe1228c;hp=9ae57a974e08cf1054b4a51b19988f065a7d4228;hpb=d546791d3ab1cbf8cb08b27eab1fc09e1c5d04dc;p=elogind.git diff --git a/tdb/tdb.c b/tdb/tdb.c index 9ae57a974..e87ea3692 100644 --- a/tdb/tdb.c +++ b/tdb/tdb.c @@ -65,6 +65,7 @@ #include #include "tdb.h" #include "spinlock.h" +#include "../udev_lib.h" #else #include "includes.h" #endif @@ -1736,6 +1737,12 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags, goto fail; /* errno set by open(2) */ } + /* + Close file when execing another process. + Prevents SELinux access errors. + */ + set_cloexec_flag(tdb->fd, 1); + /* ensure there is only one process initialising at once */ if (tdb_brlock(tdb, GLOBAL_LOCK, F_WRLCK, F_SETLKW, 0) == -1) { TDB_LOG((tdb, 0, "tdb_open_ex: failed to get global lock on %s: %s\n",