diff --git a/src/bbs.c b/src/bbs.c index 8eca852..7ae3b45 100644 --- a/src/bbs.c +++ b/src/bbs.c @@ -775,7 +775,7 @@ void runbbs_real(int socket, char *ip, int ssh) { st.sa_handler = sigterm_handler2; sigemptyset(&st.sa_mask); st.sa_flags = SA_SIGINFO; - if (sigaction(SIGTERM, &st, NULL) == -1) { + if (sigaction((ssh ? SIGHUP : SIGTERM), &st, NULL) == -1) { dolog("Failed to setup sigterm handler."); exit(1); } diff --git a/src/main.c b/src/main.c index 5466722..4f28d71 100644 --- a/src/main.c +++ b/src/main.c @@ -684,8 +684,6 @@ static void ssh_chan_close(ssh_session session, ssh_channel channel, void *userd int status; (void)session; (void)channel; - kill(bbs_pid, SIGTERM); - waitpid(bbs_pid, &status, 0); close(fd); }