The receiver can still opt-out for this with fcntl(), but by default,
we should really set O_CLOEXEC.
Signed-off-by: Daniel Mack <daniel@zonque.org>
/* 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;
/* 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;