mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Unify tmate-debug.c with tmate
This commit is contained in:
parent
f132989294
commit
ecc15f6022
@ -85,15 +85,16 @@ void tmate_print_stack_trace(void)
|
||||
free (strings);
|
||||
}
|
||||
|
||||
static void handle_crash(__unused int sig)
|
||||
static void handle_crash(int sig)
|
||||
{
|
||||
/*
|
||||
* XXX we are in a signal handler, we are not allowed to use malloc
|
||||
* and friends, which is what we do
|
||||
*/
|
||||
tmate_info("CRASH, printing stack trace");
|
||||
/* TODO send stack trace to server */
|
||||
const char *what = sig == SIGSEGV ? "SIGSEGV" : "SIGABRT";
|
||||
tmate_info("%s printing stack trace", what);
|
||||
tmate_print_stack_trace();
|
||||
tmate_fatal("CRASHED");
|
||||
|
||||
/* Reraise */
|
||||
signal(sig, NULL);
|
||||
kill(getpid(), sig);
|
||||
}
|
||||
|
||||
void tmate_catch_sigsegv(void)
|
||||
|
@ -442,13 +442,6 @@ static void handle_sigchld(__unused int sig)
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_sigsegv(__unused int sig)
|
||||
{
|
||||
tmate_info("CRASH, printing stack trace");
|
||||
tmate_print_stack_trace();
|
||||
tmate_fatal("CRASHED");
|
||||
}
|
||||
|
||||
void tmate_ssh_server_main(struct tmate_session *session, const char *keys_dir,
|
||||
const char *bind_addr, int port)
|
||||
{
|
||||
@ -457,7 +450,7 @@ void tmate_ssh_server_main(struct tmate_session *session, const char *keys_dir,
|
||||
pid_t pid;
|
||||
int fd;
|
||||
|
||||
signal(SIGSEGV, handle_sigsegv);
|
||||
tmate_catch_sigsegv();
|
||||
signal(SIGCHLD, handle_sigchld);
|
||||
|
||||
bind = prepare_ssh(keys_dir, bind_addr, port);
|
||||
|
Loading…
x
Reference in New Issue
Block a user