mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 21:33:02 +01:00
double signal handler prevents accidental closes
This commit is contained in:
parent
09e2690211
commit
acee4615f8
@ -104,9 +104,16 @@ static struct user_password {
|
|||||||
int len;
|
int len;
|
||||||
} user_password;
|
} user_password;
|
||||||
|
|
||||||
|
static time_t last_signal_time;
|
||||||
|
|
||||||
static void catch_SIGINT(int sig)
|
static void catch_SIGINT(int sig)
|
||||||
{
|
{
|
||||||
Winthread.sig_exit_toxic = 1;
|
time_t cur_time = get_unix_time();
|
||||||
|
if (difftime(cur_time, last_signal_time) <= 1) {
|
||||||
|
Winthread.sig_exit_toxic = 1;
|
||||||
|
} else {
|
||||||
|
last_signal_time = cur_time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void catch_SIGSEGV(int sig)
|
static void catch_SIGSEGV(int sig)
|
||||||
|
Loading…
Reference in New Issue
Block a user