Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 130701790bf2d95e902edf16031ff596 > files > 240

autofs-5.0.1-0.rc2.164.el5_8.src.rpm

diff -up autofs-5.0.1/daemon/state.c.hi-res-time autofs-5.0.1/daemon/state.c
--- autofs-5.0.1/daemon/state.c.hi-res-time	2007-10-18 14:42:58.000000000 +0800
+++ autofs-5.0.1/daemon/state.c	2007-10-18 14:45:49.000000000 +0800
@@ -894,6 +894,7 @@ static void *st_queue_handler(void *arg)
 	struct list_head *head;
 	struct list_head *p;
 	struct timespec wait;
+	struct timeval now;
 	int status, ret;
 
 	st_mutex_lock();
@@ -904,8 +905,9 @@ static void *st_queue_handler(void *arg)
 		 * entry is added.
 		 */
 		head = &state_queue;
-		wait.tv_sec = time(NULL) + 1;
-		wait.tv_nsec = 0;
+		gettimeofday(&now, NULL);
+		wait.tv_sec = now.tv_sec + 1;
+		wait.tv_nsec = now.tv_usec * 1000;
 
 		while (list_empty(head)) {
 			status = pthread_cond_timedwait(&cond, &mutex, &wait);
@@ -939,8 +941,9 @@ static void *st_queue_handler(void *arg)
 		}
 
 		while (1) {
-			wait.tv_sec = time(NULL) + 1;
-			wait.tv_nsec = 0;
+			gettimeofday(&now, NULL);
+			wait.tv_sec = now.tv_sec + 1;
+			wait.tv_nsec = now.tv_usec * 1000;
 
 			signaled = 0;
 			while (!signaled) {
diff -up autofs-5.0.1/lib/alarm.c.hi-res-time autofs-5.0.1/lib/alarm.c
--- autofs-5.0.1/lib/alarm.c.hi-res-time	2007-10-18 14:42:58.000000000 +0800
+++ autofs-5.0.1/lib/alarm.c	2007-10-18 14:51:03.000000000 +0800
@@ -177,6 +177,7 @@ static void *alarm_handler(void *arg)
 	head = &alarms;
 
 	while (1) {
+		struct timeval usecs;
 		struct alarm *current;
 
 		/*
@@ -215,8 +216,9 @@ static void *alarm_handler(void *arg)
 			continue;
 		}
 
+		gettimeofday(&usecs, NULL);
 		expire.tv_sec = current->time;
-		expire.tv_nsec = 0;
+		expire.tv_nsec = usecs.tv_usec * 1000;
 
 		while (1) {
 			struct autofs_point *ap;