Skip to contentSkip to conversation

udev needs fcntl(fd, F_SETFD, FD_CLOEXEC) for .udev.tdb

PATCH Harald Hoyer 1 participant 1 message Jul 22, 2004

lore
Share & tools
lore
#0 lore raw

see http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=128304

tdb/tdb.c renamed from tdb/tdb.c.cloexec +6 -0
@@ -1736,6 +1736,12 @@
 		goto fail;	/* errno set by open(2) */
 	}
 
+	/* 
+	   Close file when execing another process.  
+	   Prevents SELinux access errors.
+	*/
+	fcntl(tdb->fd, F_SETFD, FD_CLOEXEC);
+
 	/* 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",