From 1c2f100db08bed45d4eec7ec375ea88fcec67f90 Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Sun, 13 Jul 2003 07:00:17 +0000
Subject: [PATCH] (oop_sys_run): Added a few assertions to try to figure out
 why select 	still returns EINVAL sometimes.

Signed-off-by: Magnus Holmgren <magnus@kibibyte.se>
---
 sys.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sys.c b/sys.c
index e39aa4f..363a274 100644
--- a/sys.c
+++ b/sys.c
@@ -337,6 +337,8 @@ void *oop_sys_run_once(oop_source_sys *sys) {
 			tv.tv_sec = 0;
 			tv.tv_usec = 0;
 		}
+		assert(tv.tv_usec >= 0);
+		assert(tv.tv_usec < 1000000);
 	}
 
 	if (!sys->sig_active) sys->do_jmp = !sigsetjmp(sys->env,1);
@@ -364,7 +366,13 @@ void *oop_sys_run_once(oop_source_sys *sys) {
 		if (NULL != sys->files[i][OOP_EXCEPTION].f) FD_SET(i,&xfd);
 	}
 
+	assert(ptv == NULL
+	       || (ptv->tv_usec >= 0 && ptv->tv_usec < 1000000));
 	do
+		assert(ptv == NULL
+		       || (ptv->tv_usec >= 0
+			   && ptv->tv_usec < 1000000));
+		assert(sys->num_files >= 0);
 		rv = select(sys->num_files,&rfd,&wfd,&xfd,ptv);
 	while (0 > rv && EINTR == errno);
 
-- 
GitLab