From: Costa Tsaousis (ktsaou) Date: Tue, 1 Nov 2016 22:53:30 +0000 (+0200) Subject: fix for 100% CPU time when -l -Q are given X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f25e1ff8be8014b25175047b4f55ca7401eda2b;p=fping.git fix for 100% CPU time when -l -Q are given --- diff --git a/src/fping.c b/src/fping.c index 205638a..acefc6a 100644 --- a/src/fping.c +++ b/src/fping.c @@ -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 ( ¤t_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; }