]> git.gsnw.org Git - fping.git/commitdiff
fix for 100% CPU time when -l -Q are given
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Tue, 1 Nov 2016 22:53:30 +0000 (00:53 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Tue, 1 Nov 2016 22:53:30 +0000 (00:53 +0200)
src/fping.c

index 205638a07333362fa8b9eb6b25e4ba59f78f395c..acefc6a3c641eb34c707da22ea44146a5304f8bf 100644 (file)
@@ -1101,6 +1101,8 @@ void main_loop()
         /* Make sure we don't wait too long, in case a report is expected */
         if( report_interval && ( loop_flag || count_flag ) ) {
                wait_time_next_report = timeval_diff ( &current_time, &next_report_time );
+               if(wait_time_next_report < 0)
+                    wait_time_next_report = -wait_time_next_report;
                if(wait_time_next_report < wait_time) {
                     wait_time = wait_time_next_report;
                     if(wait_time < 0) { wait_time = 0; }