From: deepak0004 Date: Wed, 17 Oct 2018 21:58:38 +0000 (+0530) Subject: Changing the exit code as per travis ci X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9812557c71fa56dd444bff5152abd9fdcc969c1b;p=fping.git Changing the exit code as per travis ci --- 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)