1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:08:10 +00:00

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.
This commit is contained in:
Brian Gianforcaro 2021-09-11 09:47:44 -07:00 committed by Andreas Kling
parent 7691c7abcb
commit 3590c55b69

View file

@ -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;
}