]> git.gsnw.org Git - fping.git/commitdiff
Changing the exit code as per travis ci
authordeepak0004 <deepak14036@iiitd.ac.in>
Wed, 17 Oct 2018 21:58:38 +0000 (03:28 +0530)
committerdeepak0004 <deepak14036@iiitd.ac.in>
Wed, 17 Oct 2018 21:58:38 +0000 (03:28 +0530)
src/fping.c

index 9101ee2c29ffa8244ba457b606320945c38d3e24..89642155fdf24559863c2f5dc7ad998bda8012be 100644 (file)
@@ -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)