[dovecot-cvs] dovecot/src/lib ioloop.c,1.35.2.5,1.35.2.6

tss at dovecot.org tss at dovecot.org
Wed Mar 7 15:40:06 EET 2007


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv28935

Modified Files:
      Tag: branch_1_0
	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.35.2.5
retrieving revision 1.35.2.6
diff -u -d -r1.35.2.5 -r1.35.2.6
--- ioloop.c	6 Mar 2007 18:27:11 -0000	1.35.2.5
+++ ioloop.c	7 Mar 2007 13:40:04 -0000	1.35.2.6
@@ -235,8 +235,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