From: Daniel Mack Date: Fri, 17 Oct 2014 07:55:51 +0000 (+0200) Subject: queue: set O_CLOEXEC on installed file descriptors X-Git-Tag: upstream/0.20141102.012929utc~84 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=edf96a5e4328bf12c0c29323bc9c0ec55cab129a;p=platform%2Fcore%2Fsystem%2Fkdbus-bus.git 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 --- 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;