From f542307a9887b9cc5c2a6c0e6aa8c9795ebdce45 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 9 Mar 2008 18:00:17 +0000 Subject: [PATCH] We didn't copy the close-on-exec flags on fork(), thus always leaving all FDs in a fork()+exec()ed child open. Makes Perl test t/run/cloexec.t pass. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24336 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/fs/vfs.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index 751b93db28..c07c5b85bf 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -3792,6 +3792,9 @@ vfs_new_io_context(void *_parentContext) context->num_used_fds++; atomic_add(&descriptor->ref_count, 1); atomic_add(&descriptor->open_count, 1); + + if (fd_close_on_exec(parentContext, i)) + fd_set_close_on_exec(context, i, true); } }