From c950ceccea358660532684ced9c3bb3b7159d09d Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Thu, 15 Feb 2018 13:24:27 +0100 Subject: [PATCH] Return -1 when socket_can_read times out. 0 is a valid file descriptor. Use -1 instead to signal a timeout. --- src/fping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fping.c b/src/fping.c index 2a885e4..d4d112f 100644 --- a/src/fping.c +++ b/src/fping.c @@ -1716,7 +1716,7 @@ select_again: #endif } - return 0; + return -1; } int receive_packet(int socket, @@ -2005,7 +2005,7 @@ int wait_for_reply(long wait_time) to.tv_usec = 0; } s = socket_can_read(&to); - if (s == 0) { + if (s == -1) { return 0; /* timeout */ }