Forgot to modify the fds array in remove children

This commit is contained in:
Kovid Goyal 2017-09-08 08:30:52 +05:30
parent c97afd7b44
commit 6379b3f898
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -532,9 +532,11 @@ remove_children(ChildMonitor *self) {
remove_queue[remove_queue_count] = children[i];
remove_queue_count++;
children[i] = EMPTY_CHILD;
fds[EXTRA_FDS + i].fd = -1;
size_t num_to_right = self->count - 1 - i;
if (num_to_right > 0) {
memmove(children + i, children + i + 1, num_to_right * sizeof(Child));
memmove(fds + EXTRA_FDS + i, fds + EXTRA_FDS + i + 1, num_to_right * sizeof(struct pollfd));
}
}
}