From 27a5c51f3f0f50a7ee41d517b02bf7f2f69e07cf Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Fri, 18 Dec 2020 16:42:32 +0000 Subject: [PATCH] LibCore: UDPServer::bind: Replace bind failure assert() with perror() --- Libraries/LibCore/UDPServer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Libraries/LibCore/UDPServer.cpp b/Libraries/LibCore/UDPServer.cpp index f122db2a519..b7aaea78e78 100644 --- a/Libraries/LibCore/UDPServer.cpp +++ b/Libraries/LibCore/UDPServer.cpp @@ -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);