mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 00:27:35 +00:00
Ladybird: Close the other side's file descriptors after forking
When spawning a WebContent process, we have to close the file descriptors belonging to the "other side" in both processes, or they will not get naturally "cleaned up" when one of the processes exits. Fixes #93
This commit is contained in:
parent
7362755f30
commit
52a7282c64
1 changed files with 6 additions and 0 deletions
|
@ -563,6 +563,9 @@ void WebContentView::create_client()
|
|||
|
||||
auto child_pid = fork();
|
||||
if (!child_pid) {
|
||||
MUST(Core::System::close(ui_fd_passing_fd));
|
||||
MUST(Core::System::close(ui_fd));
|
||||
|
||||
auto takeover_string = String::formatted("x:{}", wc_fd);
|
||||
MUST(Core::System::setenv("SOCKET_TAKEOVER"sv, takeover_string, true));
|
||||
|
||||
|
@ -577,6 +580,9 @@ void WebContentView::create_client()
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
MUST(Core::System::close(wc_fd_passing_fd));
|
||||
MUST(Core::System::close(wc_fd));
|
||||
|
||||
auto socket = MUST(Core::Stream::LocalSocket::adopt_fd(ui_fd));
|
||||
MUST(socket->set_blocking(true));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue