From d685fad38fd34220f76375925fccb2040943a7a2 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 23 Jan 2025 20:57:11 -0600 Subject: [PATCH] Update: The threaded signal handler to avoid signal id races. Apply the same anti-race improvements implemented on the non-threaded signal checker to the threaded signal checker. Still check for a negative id to prevent the signal message from being printed more than once. --- level_3/example/c/main/signal.c | 2 +- level_3/fake/c/main/signal.c | 2 +- level_3/firewall/c/main/signal.c | 2 +- level_3/fss_identify/c/main/signal.c | 2 +- level_3/fss_read/c/main/signal.c | 2 +- level_3/fss_write/c/main/signal.c | 2 +- level_3/iki_read/c/main/signal.c | 2 +- level_3/iki_write/c/main/signal.c | 2 +- level_3/status_code/c/main/signal.c | 2 +- level_3/utf8/c/main/signal.c | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/level_3/example/c/main/signal.c b/level_3/example/c/main/signal.c index 624db5f..3ee3fab 100644 --- a/level_3/example/c/main/signal.c +++ b/level_3/example/c/main/signal.c @@ -29,7 +29,7 @@ extern "C" { #if !defined(_di_example_signal_check_) && !defined(_di_thread_support_) f_status_t example_signal_check(example_main_t * const main) { - if (!main || main->program.signal.id == -1) return F_false; + if (!main) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/fake/c/main/signal.c b/level_3/fake/c/main/signal.c index dfb48cc..d0c1fe4 100644 --- a/level_3/fake/c/main/signal.c +++ b/level_3/fake/c/main/signal.c @@ -29,7 +29,7 @@ extern "C" { #if !defined(_di_fake_signal_check_) && !defined(_di_thread_support_) f_status_t fake_signal_check(fake_main_t * const main) { - if (!main || main->program.signal.id == -1) return F_false; + if (!main) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/firewall/c/main/signal.c b/level_3/firewall/c/main/signal.c index e35882e..7711f74 100644 --- a/level_3/firewall/c/main/signal.c +++ b/level_3/firewall/c/main/signal.c @@ -29,7 +29,7 @@ extern "C" { #if !defined(_di_firewall_signal_check_) && !defined(_di_thread_support_) f_status_t firewall_signal_check(firewall_main_t * const main) { - if (!main || main->program.signal.id == -1) return F_false; + if (!main) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/fss_identify/c/main/signal.c b/level_3/fss_identify/c/main/signal.c index 61262d7..b633959 100644 --- a/level_3/fss_identify/c/main/signal.c +++ b/level_3/fss_identify/c/main/signal.c @@ -29,7 +29,7 @@ extern "C" { #if !defined(_di_fss_identify_signal_check_) && !defined(_di_thread_support_) f_status_t fss_identify_signal_check(fss_identify_main_t * const main) { - if (!main || main->program.signal.id == -1) return F_false; + if (!main) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/fss_read/c/main/signal.c b/level_3/fss_read/c/main/signal.c index 023cb5b..8dc4ea2 100644 --- a/level_3/fss_read/c/main/signal.c +++ b/level_3/fss_read/c/main/signal.c @@ -29,7 +29,7 @@ extern "C" { #if !defined(_di_fss_read_signal_check_) && !defined(_di_thread_support_) f_status_t fss_read_signal_check(fss_read_main_t * const main) { - if (!main || main->program.signal.id == -1) return F_false; + if (!main) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/fss_write/c/main/signal.c b/level_3/fss_write/c/main/signal.c index 2b45589..37027ce 100644 --- a/level_3/fss_write/c/main/signal.c +++ b/level_3/fss_write/c/main/signal.c @@ -29,7 +29,7 @@ extern "C" { #if !defined(_di_fss_write_signal_check_) && !defined(_di_thread_support_) f_status_t fss_write_signal_check(fss_write_main_t * const main) { - if (!main || main->program.signal.id == -1) return F_false; + if (!main) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/iki_read/c/main/signal.c b/level_3/iki_read/c/main/signal.c index 56cc1eb..36854ea 100644 --- a/level_3/iki_read/c/main/signal.c +++ b/level_3/iki_read/c/main/signal.c @@ -29,7 +29,7 @@ extern "C" { #if !defined(_di_iki_read_signal_check_) && !defined(_di_thread_support_) f_status_t iki_read_signal_check(iki_read_main_t * const main) { - if (!main || main->program.signal.id == -1) return F_false; + if (!main) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/iki_write/c/main/signal.c b/level_3/iki_write/c/main/signal.c index 6357e75..8bf9e38 100644 --- a/level_3/iki_write/c/main/signal.c +++ b/level_3/iki_write/c/main/signal.c @@ -29,7 +29,7 @@ extern "C" { #if !defined(_di_iki_write_signal_check_) && !defined(_di_thread_support_) f_status_t iki_write_signal_check(iki_write_main_t * const main) { - if (!main || main->program.signal.id == -1) return F_false; + if (!main) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/status_code/c/main/signal.c b/level_3/status_code/c/main/signal.c index 183446b..3aaea4a 100644 --- a/level_3/status_code/c/main/signal.c +++ b/level_3/status_code/c/main/signal.c @@ -29,7 +29,7 @@ extern "C" { #if !defined(_di_status_code_signal_check_) && !defined(_di_thread_support_) f_status_t status_code_signal_check(status_code_main_t * const main) { - if (!main || main->program.signal.id == -1) return F_false; + if (!main) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/utf8/c/main/signal.c b/level_3/utf8/c/main/signal.c index fbe1248..64f391d 100644 --- a/level_3/utf8/c/main/signal.c +++ b/level_3/utf8/c/main/signal.c @@ -29,7 +29,7 @@ extern "C" { #if !defined(_di_utf8_signal_check_) && !defined(_di_thread_support_) f_status_t utf8_signal_check(utf8_main_t * const main) { - if (!main || main->program.signal.id == -1) return F_false; + if (!main) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); -- 1.8.3.1