Skip to content

Commit

Permalink
fix: don't try to safely exit if we receive SIGINT
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierChanth committed Oct 18, 2024
1 parent 693870e commit c58a909
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/c/sshnpd/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,7 @@ static bool is_child_process = false;
static volatile sig_atomic_t should_run = 1;
static void exit_handler(int sig) {
atlogger_log("exit_handler", ATLOGGER_LOGGING_LEVEL_WARN, "Received signal: %d\n");
if (should_run == 1) {
atlogger_log("exit_handler", ATLOGGER_LOGGING_LEVEL_WARN, "Received SIGINT, attempting a safe exit\n");
should_run = 0;
} else if (should_run == 0) {
atlogger_log("exit_handler", ATLOGGER_LOGGING_LEVEL_WARN, "Received SIGINT again, exiting forcefully\n");
exit(1);
}
exit(1);
}
static void child_exit_handler(int sig) {
atlogger_log("child_exit_handler", ATLOGGER_LOGGING_LEVEL_WARN, "Received signal: %d\n");
Expand Down

0 comments on commit c58a909

Please sign in to comment.