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:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user