bonefish+mmlr:

The O_CLOEXEC open mode wasn't actually set in the close-on-exec bitmap causing
all files opened with O_CLOEXEC (like done in the storage kit classes) to still
be inherited. This caused for example to be unable to unmount volumes when
opening apps while Tracker touched some files (i.e. copying some large files)
since these apps would inherit the file descriptor and therefore keep the
volume busy.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36273 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2010-04-14 21:46:14 +00:00
parent 74fc3e9a8b
commit 1888e2289d
1 changed files with 6 additions and 1 deletions

View File

@ -2857,12 +2857,17 @@ get_new_fd(int type, struct fs_mount* mount, struct vnode* vnode,
descriptor->type = type;
descriptor->open_mode = openMode;
fd = new_fd(get_current_io_context(kernel), descriptor);
io_context* context = get_current_io_context(kernel);
fd = new_fd(context, descriptor);
if (fd < 0) {
free(descriptor);
return B_NO_MORE_FDS;
}
mutex_lock(&context->io_mutex);
fd_set_close_on_exec(context, fd, (openMode & O_CLOEXEC) != 0);
mutex_unlock(&context->io_mutex);
return fd;
}