mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:37:45 +00:00
WindowServer: Don't crash when accept() fails, just log an error.
This was easy to hit by opening enough windows to hit the max open file descriptors limit. :^)
This commit is contained in:
parent
a02c945ef2
commit
31d3616027
1 changed files with 6 additions and 6 deletions
|
@ -75,7 +75,7 @@ int WSMessageLoop::exec()
|
|||
void WSMessageLoop::post_message(WSMessageReceiver& receiver, OwnPtr<WSMessage>&& message)
|
||||
{
|
||||
#ifdef WSMESSAGELOOP_DEBUG
|
||||
dbgprintf("WSMessageLoop::post_message: {%u} << receiver=%p, message=%p (type=%u)\n", m_queued_messages.size(), receiver, message.ptr(), message->type());
|
||||
dbgprintf("WSMessageLoop::post_message: {%u} << receiver=%p, message=%p (type=%u)\n", m_queued_messages.size(), &receiver, message.ptr(), message->type());
|
||||
#endif
|
||||
m_queued_messages.append({ receiver.make_weak_ptr(), move(message) });
|
||||
}
|
||||
|
@ -169,12 +169,12 @@ void WSMessageLoop::wait_for_message()
|
|||
sockaddr_un address;
|
||||
socklen_t address_size = sizeof(address);
|
||||
int client_fd = accept(m_server_fd, (sockaddr*)&address, &address_size);
|
||||
#ifdef WSMESSAGELOOP_DEBUG
|
||||
dbgprintf("accept() returned fd=%d, address=%s\n", client_fd, address.sun_path);
|
||||
#endif
|
||||
ASSERT(client_fd >= 0);
|
||||
if (client_fd < 0) {
|
||||
dbgprintf("WindowServer: accept() failed: %s\n", strerror(errno));
|
||||
} else {
|
||||
new WSClientConnection(client_fd);
|
||||
}
|
||||
}
|
||||
WSClientConnection::for_each_client([&] (WSClientConnection& client) {
|
||||
if (!FD_ISSET(client.fd(), &rfds))
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue