From: Wayne Davison Date: Sun, 19 May 2013 22:52:00 +0000 (+0000) Subject: Fix msleep() if time goes backwards. Fixes bug 9789. X-Git-Tag: v3.1.0pre1~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2dc2070992c00ea6625031813f2b6c886ddc3ade;p=thirdparty%2Frsync.git Fix msleep() if time goes backwards. Fixes bug 9789. --- diff --git a/util.c b/util.c index af0250cf..0799dff5 100644 --- a/util.c +++ b/util.c @@ -1320,6 +1320,8 @@ int msleep(int t) select(0,NULL,NULL, NULL, &tval); gettimeofday(&t2, NULL); + if (t2.tv_sec < t1.tv_sec) + t1 = t2; /* Time went backwards, so start over. */ tdiff = (t2.tv_sec - t1.tv_sec)*1000 + (t2.tv_usec - t1.tv_usec)/1000; }