socket_fs: invalidate fd on context destruction

This prevents accesses to `Socket_fs::Context::_fd_ready_ready()` that
caused a "__cxa_pure_virtual called" error.

Fixes #5265
This commit is contained in:
Johannes Schlatow 2024-07-04 11:55:26 +02:00 committed by Christian Helmuth
parent 96ef527436
commit 7b8a2e77e4

View File

@ -236,7 +236,11 @@ struct Libc::Socket_fs::Context : Plugin_context
~Context()
{
_fd_apply([] (int fd) { ::close(fd); });
for (unsigned i = 0; i < Fd::MAX; ++i) {
::close(_fd[i].num);
_fd[i].num = -1;
_fd[i].file = nullptr;
}
::close(_handle_fd);
}