From 08e82ddaf0b606d86cda2cfef7fbc32011b38ade Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sat, 10 May 2025 16:35:59 -0400 Subject: [PATCH] LibCore: Prefer Error::is_errno over Error::is_syscall These are the only users of the latter, so let's just use is_errno (which will effectively give us the same result) to avoid confusion over these. --- Libraries/LibIPC/TransportSocket.cpp | 6 +++--- Tests/LibCore/TestLibCoreStream.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/LibIPC/TransportSocket.cpp b/Libraries/LibIPC/TransportSocket.cpp index 502dc0e18ca..8241dcfef8d 100644 --- a/Libraries/LibIPC/TransportSocket.cpp +++ b/Libraries/LibIPC/TransportSocket.cpp @@ -218,11 +218,11 @@ TransportSocket::ShouldShutdown TransportSocket::read_as_many_messages_as_possib auto maybe_bytes_read = m_socket->receive_message({ buffer, 4096 }, MSG_DONTWAIT, received_fds); if (maybe_bytes_read.is_error()) { auto error = maybe_bytes_read.release_error(); - if (error.is_syscall() && error.code() == EAGAIN) { + + if (error.is_errno() && error.code() == EAGAIN) { break; } - - if (error.is_syscall() && error.code() == ECONNRESET) { + if (error.is_errno() && error.code() == ECONNRESET) { should_shutdown = true; break; } diff --git a/Tests/LibCore/TestLibCoreStream.cpp b/Tests/LibCore/TestLibCoreStream.cpp index 490ccf3a566..8ccd1e94ac6 100644 --- a/Tests/LibCore/TestLibCoreStream.cpp +++ b/Tests/LibCore/TestLibCoreStream.cpp @@ -178,7 +178,7 @@ TEST_CASE(should_error_when_connection_fails) auto maybe_tcp_socket = Core::TCPSocket::connect({ { 127, 0, 0, 1 }, 1234 }); EXPECT(maybe_tcp_socket.is_error()); - EXPECT(maybe_tcp_socket.error().is_syscall()); + EXPECT(maybe_tcp_socket.error().is_errno()); EXPECT(maybe_tcp_socket.error().code() == ECONNREFUSED); }