From 49fdd9695dd369843e016bcd65c991aa1728a0c4 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Wed, 7 Feb 2018 18:01:17 +1000 Subject: [PATCH] fix for ssh stuck nodes --- src/bbs.c | 2 +- src/main.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) 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); }