summaryrefslogtreecommitdiff
path: root/tdb
diff options
context:
space:
mode:
authorharald@redhat.com <harald@redhat.com>2004-10-06 00:54:08 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:37:03 -0700
commit6e3e3c3416864eca74cb885f64c453eb531eed63 (patch)
treeb467f72775c46db6b8a208a61236027fce422e6a /tdb
parentc8fa2d8b413f7cf1ab42d1c35865952649bfccad (diff)
[PATCH] PATCH udev close on exec
selinux wants a clean fd set, so better close all open fds
Diffstat (limited to 'tdb')
-rw-r--r--tdb/tdb.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tdb/tdb.c b/tdb/tdb.c
index 9ae57a974e..e87ea3692e 100644
--- a/tdb/tdb.c
+++ b/tdb/tdb.c
@@ -65,6 +65,7 @@
#include <signal.h>
#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",