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>
This commit is contained in:
Jouni Malinen 2020-03-22 18:15:43 +02:00
parent ae7193611f
commit 913220cbb8
2 changed files with 7 additions and 7 deletions

View file

@ -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;

View file

@ -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;
}