mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibCore: UDPServer::bind: Replace bind failure assert() with perror()
This commit is contained in:
parent
fe88f46bc9
commit
27a5c51f3f
Notes:
sideshowbarker
2024-07-19 00:45:32 +09:00
Author: https://github.com/bcoles Commit: https://github.com/SerenityOS/serenity/commit/27a5c51f3f0 Pull-request: https://github.com/SerenityOS/serenity/pull/4455
1 changed files with 5 additions and 3 deletions
|
@ -62,12 +62,14 @@ bool UDPServer::bind(const IPv4Address& address, u16 port)
|
|||
if (m_bound)
|
||||
return false;
|
||||
|
||||
int rc;
|
||||
auto saddr = SocketAddress(address, port);
|
||||
auto in = saddr.to_sockaddr_in();
|
||||
|
||||
rc = ::bind(m_fd, (const sockaddr*)&in, sizeof(in));
|
||||
ASSERT(rc == 0);
|
||||
if (::bind(m_fd, (const sockaddr*)&in, sizeof(in)) != 0) {
|
||||
perror("UDPServer::bind");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_bound = true;
|
||||
|
||||
m_notifier = Notifier::construct(m_fd, Notifier::Event::Read, this);
|
||||
|
|
Loading…
Reference in a new issue