From 9812557c71fa56dd444bff5152abd9fdcc969c1b Mon Sep 17 00:00:00 2001 From: deepak0004 Date: Thu, 18 Oct 2018 03:28:38 +0530 Subject: [PATCH] Changing the exit code as per travis ci --- src/fping.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/fping.c b/src/fping.c index 9101ee2..8964215 100644 --- a/src/fping.c +++ b/src/fping.c @@ -1195,7 +1195,7 @@ void main_loop() h->ev_type = EV_TYPE_PING; h->ev_time.tv_sec = last_send_time.tv_sec; h->ev_time.tv_usec = last_send_time.tv_usec; - timeval_add(&h->ev_time, perhost_interval); + timeval_add(&h->ev_time, perhost_interval); ev_enqueue(h); } /* Count mode: schedule timeout after last ping */ @@ -1322,14 +1322,6 @@ void finish() } } - if (reachable_flag) { - if ((num_hosts-num_unreachable >= reachable)) { - printf(">=%d hosts are reachable\n", reachable); - } else { - printf("<%d hosts are reachable\n", reachable); - } - } - if (count_flag || loop_flag) print_per_system_stats(); #if defined(DEBUG) || defined(_DEBUG) @@ -1340,6 +1332,15 @@ void finish() if (stats_flag) print_global_stats(); + if (reachable_flag) { + if ((num_hosts-num_unreachable >= reachable)) { + printf(">=%d hosts are reachable\n", reachable); + } else { + printf("<%d hosts are reachable\n", reachable); + } + exit(0); + } + if (num_noaddress) exit(2); else if (num_alive != num_hosts) -- 2.43.0