[dovecot-cvs] dovecot/src/lib ioloop.c,1.41,1.42
tss at dovecot.org
tss at dovecot.org
Wed Mar 7 15:40:09 EET 2007
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv28930
Modified Files:
ioloop.c
Log Message:
Don't die if "time moved backwards" sleep is interrupted.
Index: ioloop.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ioloop.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- ioloop.c 6 Mar 2007 18:27:15 -0000 1.41
+++ ioloop.c 7 Mar 2007 13:40:07 -0000 1.42
@@ -238,8 +238,14 @@
"I'll sleep now until we're back in present.",
(long)diff);
/* Sleep extra second to make sure usecs also grows. */
- if (sleep(diff + 1) != 0)
- i_fatal("Sleep interrupted, byebye.");
+ diff++;
+
+ while (diff > 0 && sleep(diff) != 0) {
+ /* don't use sleep()'s return value, because
+ it could get us to a long loop in case
+ interrupts just keep coming */
+ diff = ioloop_time - time(NULL) + 1;
+ }
/* Try again. */
io_loop_handle_timeouts(ioloop);
More information about the dovecot-cvs
mailing list