changeset 22134:69f9d0c724a3

lib: guid_128_generate() shouldn't generate invalid timestamps The nsec validity check must take into account the soon-to-be-done increment.
author Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
date Mon, 05 Jun 2017 12:55:56 +0300
parents 9ccf1fdb6303
children 6feb39dacf28
files src/lib/guid.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/guid.c	Mon Jun 05 12:53:23 2017 +0300
+++ b/src/lib/guid.c	Mon Jun 05 12:55:56 2017 +0300
@@ -75,7 +75,7 @@
 		   when a GUID was created. */
 		ts.tv_sec = ioloop_timeval.tv_sec;
 		ts.tv_nsec = ioloop_timeval.tv_usec*1000;
-	} else if ((uint32_t)ts.tv_nsec < 1000000000) {
+	} else if (ts.tv_nsec < 999999999L) {
 		ts.tv_nsec++;
 	} else {
 		ts.tv_sec++;