[PATCH] eloop: add assert() on negative fd when using select() code path

Maxime Bizon mbizon at freebox.fr
Thu Mar 20 14:25:18 EDT 2014


Signed-off-by: Maxime Bizon <mbizon at freebox.fr>
---
 src/utils/eloop.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/utils/eloop.c b/src/utils/eloop.c
index f83a232..e304c67 100644
--- a/src/utils/eloop.c
+++ b/src/utils/eloop.c
@@ -13,8 +13,9 @@
 #include "list.h"
 #include "eloop.h"
 
-#ifdef CONFIG_ELOOP_POLL
 #include <assert.h>
+
+#ifdef CONFIG_ELOOP_POLL
 #include <poll.h>
 #endif /* CONFIG_ELOOP_POLL */
 
@@ -374,8 +375,10 @@ static void eloop_sock_table_set_fds(struct eloop_sock_table *table,
 	if (table->table == NULL)
 		return;
 
-	for (i = 0; i < table->count; i++)
+	for (i = 0; i < table->count; i++) {
+		assert(table->table[i].sock >= 0);
 		FD_SET(table->table[i].sock, fds);
+	}
 }
 
 
-- 
1.7.9.5



More information about the HostAP mailing list