Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't try to safely exit if we receive SIGINT #1462

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions packages/c/sshnpd/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,6 @@ static bool is_child_process = false;

// Signal handling
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);
}
}
static void child_exit_handler(int sig) {
atlogger_log("child_exit_handler", ATLOGGER_LOGGING_LEVEL_WARN, "Received signal: %d\n");
int status;
Expand All @@ -101,10 +91,6 @@ int main(int argc, char **argv) {
int res = 0;
int exit_res = 0;

// Catch sigint and pass to the handler
signal(SIGINT, exit_handler);
signal(SIGCHLD, child_exit_handler);

// 1. Load default values
apply_default_values_to_sshnpd_params(&params);

Expand Down