From 3590c55b69e2c6337ffa9445b14513686e5a99bc Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sat, 11 Sep 2021 09:47:44 -0700 Subject: [PATCH] Utilities: Fix incorrect error handling in traceroute The result will be -1 on error, and the error value will be stored in errno. PVS-Studio found this because result it saw result < 0 and new EFAULT is < 0, so this could never be true. --- Userland/Utilities/traceroute.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Utilities/traceroute.cpp b/Userland/Utilities/traceroute.cpp index ae44f05f54..5a132501b5 100644 --- a/Userland/Utilities/traceroute.cpp +++ b/Userland/Utilities/traceroute.cpp @@ -114,7 +114,7 @@ int main(int argc, char** argv) size_t peer_address_size = sizeof(peer_address); int result = recvfrom(fd, &response, sizeof(response), 0, (sockaddr*)&peer_address, (socklen_t*)&peer_address_size); if (result < 0) { - if (result == EAGAIN) + if (errno == EAGAIN) return -1; continue; }