kernel/fs: Remove special handling for O_DISCONNECTED in remove_fd().
This method is used in close_fd_index(), the normal path for close() operations to go through. So, if a close() had been called on a disconnected FD, before this commit we would just leak it. This change means that close_fd() and put_fd() are called on disconnected FDs being close()d. That's the same set of operations that deleting an I/O context does, though, so this should hopefully not cause any problems.
This commit is contained in:
@@ -324,7 +324,6 @@ remove_fd(struct io_context* context, int fd)
|
||||
descriptor = context->fds[fd];
|
||||
|
||||
select_info* selectInfos = NULL;
|
||||
bool disconnected = false;
|
||||
|
||||
if (descriptor != NULL) {
|
||||
// fd is valid
|
||||
@@ -337,14 +336,12 @@ remove_fd(struct io_context* context, int fd)
|
||||
|
||||
selectInfos = context->select_infos[fd];
|
||||
context->select_infos[fd] = NULL;
|
||||
|
||||
disconnected = (descriptor->open_mode & O_DISCONNECTED);
|
||||
}
|
||||
|
||||
if (selectInfos != NULL)
|
||||
deselect_select_infos(descriptor, selectInfos, true);
|
||||
|
||||
return disconnected ? NULL : descriptor;
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user