try again again
This commit is contained in:
parent
2f81bae845
commit
1a4a16825f
23
bbs.c
23
bbs.c
@ -24,8 +24,17 @@ int sshBBS;
|
||||
int usertimeout;
|
||||
int timeoutpaused;
|
||||
|
||||
char *ipaddress;
|
||||
|
||||
char *ipaddress;
|
||||
|
||||
void sigterm_handler(int s)
|
||||
{
|
||||
if (mynode != 0) {
|
||||
disconnect("Terminated.");
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
void dolog(char *fmt, ...) {
|
||||
char buffer[512];
|
||||
struct tm time_now;
|
||||
@ -486,7 +495,8 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
||||
struct tm oldtime;
|
||||
time_t now;
|
||||
struct itimerval itime;
|
||||
struct sigaction sa;
|
||||
struct sigaction sa;
|
||||
struct sigaction st;
|
||||
lua_State *L;
|
||||
int do_internal_login = 0;
|
||||
|
||||
@ -501,7 +511,12 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
||||
sshBBS = 1;
|
||||
}
|
||||
|
||||
|
||||
st.sa_handler = sigterm_handler;
|
||||
sigemptyset(&st.sa_mask);
|
||||
if (sigaction(SIGTERM, &st, NULL) == -1) {
|
||||
dolog("Failed to setup sigterm handler.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
gSocket = socket;
|
||||
|
||||
|
5
main.c
5
main.c
@ -28,7 +28,6 @@
|
||||
|
||||
extern struct bbs_config conf;
|
||||
extern struct user_record *gUser;
|
||||
extern int mynode;
|
||||
|
||||
int ssh_pid = -1;
|
||||
|
||||
@ -604,9 +603,7 @@ void serverssh(int port) {
|
||||
}
|
||||
ssh_disconnect(p_ssh_session);
|
||||
ssh_finalize();
|
||||
if (mynode != 0) {
|
||||
disconnect("Channel Closed");
|
||||
}
|
||||
kill(bbs_pid, SIGTERM);
|
||||
exit(0);
|
||||
} else if (pid > 0) {
|
||||
|
||||
|
Reference in New Issue
Block a user