[Openais] [PATCH]: corosync/trunk: Check absolute time value in timerlist_add_absolute

Ryan O'Hara rohara at redhat.com
Wed Feb 11 19:38:17 PST 2009


Check that the absolute time value for the first timer expiration is
valid. Absolute time values must be in the future (ie. greater than
the current time).

In this test fails, timerlist_add_absolute will set errno to EINVAL
and return -1.

-------------- next part --------------
Index: exec/tlist.h
===================================================================
--- exec/tlist.h	(revision 1758)
+++ exec/tlist.h	(working copy)
@@ -119,7 +119,12 @@
 		errno = ENOMEM;
 		return (-1);
 	}
-	
+
+	if (nano_from_epoch < timerlist_nano_from_epoch()) {
+		errno = EINVAL;
+		return (-1);
+	}
+
 	timer->nano_from_epoch = nano_from_epoch;
 	timer->data = data;
 	timer->timer_fn = timer_fn;


More information about the Openais mailing list