aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2020-03-22 16:15:43 (GMT)
committerJouni Malinen <j@w1.fi>2020-03-22 16:50:04 (GMT)
commit913220cbb881ea405b158ae2116fd769bc4f8f3e (patch)
tree87be2461866a6d60fb0155dc5f032f390c22c607
parentae7193611f69042436a9f4aaec56c0ff8f7a827a (diff)
downloadhostap-913220cbb881ea405b158ae2116fd769bc4f8f3e.zip
hostap-913220cbb881ea405b158ae2116fd769bc4f8f3e.tar.gz
hostap-913220cbb881ea405b158ae2116fd769bc4f8f3e.tar.bz2
eloop: Use size_t for signal_count
This is more consistent with the other eloop registrations and avoids a theoretical integer overflow with 16-bit int (not that there would ever be more that 32767 signal handlers getting registered). Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--src/utils/eloop.c6
-rw-r--r--src/utils/eloop_win.c8
2 files changed, 7 insertions, 7 deletions
diff --git a/src/utils/eloop.c b/src/utils/eloop.c
index bb375be..bcffeeb 100644
--- a/src/utils/eloop.c
+++ b/src/utils/eloop.c
@@ -104,7 +104,7 @@ struct eloop_data {
struct dl_list timeout;
- int signal_count;
+ size_t signal_count;
struct eloop_signal *signals;
int signaled;
int pending_terminate;
@@ -968,7 +968,7 @@ static void eloop_handle_alarm(int sig)
static void eloop_handle_signal(int sig)
{
- int i;
+ size_t i;
#ifndef CONFIG_NATIVE_WINDOWS
if ((sig == SIGINT || sig == SIGTERM) && !eloop.pending_terminate) {
@@ -992,7 +992,7 @@ static void eloop_handle_signal(int sig)
static void eloop_process_pending_signals(void)
{
- int i;
+ size_t i;
if (eloop.signaled == 0)
return;
diff --git a/src/utils/eloop_win.c b/src/utils/eloop_win.c
index 9c8b12b..74eaa33 100644
--- a/src/utils/eloop_win.c
+++ b/src/utils/eloop_win.c
@@ -54,7 +54,7 @@ struct eloop_data {
struct dl_list timeout;
- int signal_count;
+ size_t signal_count;
struct eloop_signal *signals;
int signaled;
int pending_terminate;
@@ -422,7 +422,7 @@ int eloop_replenish_timeout(unsigned int req_secs, unsigned int req_usecs,
#if 0
static void eloop_handle_signal(int sig)
{
- int i;
+ size_t i;
eloop.signaled++;
for (i = 0; i < eloop.signal_count; i++) {
@@ -437,7 +437,7 @@ static void eloop_handle_signal(int sig)
static void eloop_process_pending_signals(void)
{
- int i;
+ size_t i;
if (eloop.signaled == 0)
return;
@@ -517,7 +517,7 @@ int eloop_register_signal_terminate(eloop_signal_handler handler,
eloop.term_signal.handler = handler;
eloop.term_signal.user_data = user_data;
-
+
return 0;
}