hostapd timercmp() misusage?

Mark Glines mark-hostap
Thu Oct 30 12:23:19 PST 2003


Hi,

I just noticed that a couple places in hostapd that use timercmp() use
">=" as the operator, but my sys/time.h says:

/* Convenience macros for operations on timevals.
   NOTE: `timercmp' does not work for >= or <=.  */

Here's a patch.

Mark

--- hostapd-0.1.0/eloop.c.orig	2003-10-30 12:19:00.000000000 -0800
+++ hostapd-0.1.0/eloop.c	2003-10-30 12:19:01.000000000 -0800
@@ -220,7 +220,7 @@
 		(eloop.timeout || eloop.reader_count > 0)) {
 		if (eloop.timeout) {
 			gettimeofday(&now, NULL);
-			if (timercmp(&now, &eloop.timeout->time, >=))
+			if (timercmp(&eloop.timeout->time, &now, <))
 				tv.tv_sec = tv.tv_usec = 0;
 			else
 				timersub(&eloop.timeout->time, &now, &tv);
@@ -245,7 +245,7 @@
 			struct eloop_timeout *tmp;
 
 			gettimeofday(&now, NULL);
-			if (timercmp(&now, &eloop.timeout->time, >=)) {
+			if (timercmp(&eloop.timeout->time, &now, <)) {
 				tmp = eloop.timeout;
 				eloop.timeout = eloop.timeout->next;
 				tmp->handler(tmp->eloop_data,






More information about the Hostap mailing list