1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-23 11:33:27 +01:00

exit toxic properly on ^C

This commit is contained in:
Jfreegman 2014-07-08 20:21:51 -04:00
parent 9fa5a3fdb6
commit f98c77432b
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63

View File

@ -78,12 +78,12 @@ struct arg_opts {
} arg_opts;
struct _Winthread Winthread;
struct user_settings *user_settings = NULL;
static void ignore_SIGINT(int sig)
static bool sig_exit_toxic = false;
static void catch_SIGINT(int sig)
{
return;
sig_exit_toxic = true;
}
static void flag_window_resize(int sig)
@ -565,7 +565,7 @@ int main(int argc, char *argv[])
/* Make sure all written files are read/writeable only by the current user. */
umask(S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
signal(SIGINT, ignore_SIGINT);
signal(SIGINT, catch_SIGINT);
config_err = create_user_config_dir(user_config_dir);
@ -652,6 +652,9 @@ int main(int argc, char *argv[])
last_save = cur_time;
}
if (sig_exit_toxic)
exit_toxic_success(m);
usleep(40000);
}