Fix problem with CLOEXEC also being handled on fork(). For details on expected (BeOS) behaviour, see http://www.freelists.org/archives/openbeos/12-2001/msg00280.html

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23456 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ithamar R. Adema
2008-01-12 23:48:52 +00:00
parent f3ecf93d37
commit 0fc976d900
2 changed files with 5 additions and 2 deletions
+2 -2
View File
@@ -3501,7 +3501,7 @@ vfs_unlock_vnode_if_locked(struct file_descriptor *descriptor)
/*! Closes all file descriptors of the specified I/O context that
don't have the O_CLOEXEC flag set.
have the O_CLOEXEC flag set.
*/
void
vfs_exec_io_context(void *_context)
@@ -3591,7 +3591,7 @@ vfs_new_io_context(void *_parentContext)
for (i = 0; i < tableSize; i++) {
struct file_descriptor *descriptor = parentContext->fds[i];
if (descriptor != NULL && !fd_close_on_exec(parentContext, i)) {
if (descriptor != NULL) {
context->fds[i] = descriptor;
context->num_used_fds++;
atomic_add(&descriptor->ref_count, 1);
+3
View File
@@ -931,6 +931,9 @@ load_image_etc(int32 argCount, char * const *args, int32 envCount,
goto err2;
}
// remove any fds that have the CLOEXEC flag set (emulating BeOS behaviour)
vfs_exec_io_context(team->io_context);
// create an address space for this team
status = vm_create_address_space(team->id, USER_BASE, USER_SIZE, false,
&team->address_space);