$OpenBSD: patch-pbx_pbx_spool_c,v 1.3 2012/12/11 14:46:41 sthen Exp $

Don't pass an invalid time limit to kevent() if the directory list is empty
(limit is 100M seconds; see itimerfix() in /sys/kern/kern_time.c).

--- pbx/pbx_spool.c.orig	Mon Oct  8 22:11:41 2012
+++ pbx/pbx_spool.c	Tue Dec 11 14:34:03 2012
@@ -742,7 +742,7 @@ static void *scan_thread(void *unused)
 		queue_created_files();
 #else
 			struct timespec ts2 = { next - now, 0 };
-			if (kevent(inotify_fd, NULL, 0, &kev, 1, &ts2) <= 0) {
+			if (kevent(inotify_fd, NULL, 0, &kev, 1, next == INT_MAX ? NULL : &ts2) <= 0) {
 				/* Interrupt or timeout, restart calculations */
 				continue;
 			} else {
