eloop: Add assert() on negative fd when using select() code path

Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
This commit is contained in:
Maxime Bizon 2014-03-20 19:25:18 +01:00 committed by Jouni Malinen
parent 978c673052
commit 762c41ae99

View File

@ -7,6 +7,7 @@
*/
#include "includes.h"
#include <assert.h>
#include "common.h"
#include "trace.h"
@ -14,7 +15,6 @@
#include "eloop.h"
#ifdef CONFIG_ELOOP_POLL
#include <assert.h>
#include <poll.h>
#endif /* CONFIG_ELOOP_POLL */
@ -374,8 +374,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);
}
}
@ -459,6 +461,7 @@ int eloop_register_sock(int sock, eloop_event_type type,
{
struct eloop_sock_table *table;
assert(sock >= 0);
table = eloop_get_sock_table(type);
return eloop_sock_table_add_sock(table, sock, handler,
eloop_data, user_data);