From edf96a5e4328bf12c0c29323bc9c0ec55cab129a Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Fri, 17 Oct 2014 09:55:51 +0200 Subject: [PATCH] queue: set O_CLOEXEC on installed file descriptors The receiver can still opt-out for this with fcntl(), but by default, we should really set O_CLOEXEC. Signed-off-by: Daniel Mack --- queue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/queue.c b/queue.c index e89d720..e480378 100644 --- a/queue.c +++ b/queue.c @@ -115,7 +115,7 @@ static int kdbus_queue_entry_fds_install(struct kdbus_queue_entry *entry, /* allocate new file descriptors in the receiver's process */ for (i = 0; i < entry->fds_count; i++) { - fds[i] = get_unused_fd(); + fds[i] = get_unused_fd_flags(O_CLOEXEC); if (fds[i] < 0) { ret = fds[i]; goto remove_unused; @@ -161,7 +161,7 @@ static int kdbus_queue_entry_memfds_install(struct kdbus_queue_entry *entry, /* allocate new file descriptors in the receiver's process */ for (i = 0; i < entry->memfds_count; i++) { - fds[i] = get_unused_fd(); + fds[i] = get_unused_fd_flags(O_CLOEXEC); if (fds[i] < 0) { ret = fds[i]; goto remove_unused; -- 2.34.1