mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Added option to quit in SIGHUP
This commit is contained in:
parent
8b7bf1f04e
commit
81dc94c406
@ -88,6 +88,11 @@ static void sig_reload_config(int signo)
|
|||||||
reload_config = TRUE;
|
reload_config = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sig_quit_on_hup(int signo)
|
||||||
|
{
|
||||||
|
signal_emit("gui exit", 0);
|
||||||
|
}
|
||||||
|
|
||||||
static void read_settings(void)
|
static void read_settings(void)
|
||||||
{
|
{
|
||||||
static int signals[] = {
|
static int signals[] = {
|
||||||
@ -102,14 +107,16 @@ static void read_settings(void)
|
|||||||
const char *ignores;
|
const char *ignores;
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
int n;
|
int n;
|
||||||
|
int quit_on_hup;
|
||||||
|
|
||||||
ignores = settings_get_str("ignore_signals");
|
ignores = settings_get_str("ignore_signals");
|
||||||
|
|
||||||
sigemptyset (&act.sa_mask);
|
sigemptyset (&act.sa_mask);
|
||||||
act.sa_flags = 0;
|
act.sa_flags = 0;
|
||||||
|
|
||||||
/* reload config on SIGHUP */
|
quit_on_hup = settings_get_bool("quit_on_hup");
|
||||||
act.sa_handler = sig_reload_config;
|
|
||||||
|
act.sa_handler = quit_on_hup ? sig_quit_on_hup : sig_reload_config;
|
||||||
sigaction(SIGHUP, &act, NULL);
|
sigaction(SIGHUP, &act, NULL);
|
||||||
|
|
||||||
for (n = 0; n < sizeof(signals)/sizeof(signals[0]); n++) {
|
for (n = 0; n < sizeof(signals)/sizeof(signals[0]); n++) {
|
||||||
@ -267,6 +274,8 @@ void core_init(void)
|
|||||||
|
|
||||||
settings_add_str("misc", "ignore_signals", "");
|
settings_add_str("misc", "ignore_signals", "");
|
||||||
settings_add_bool("misc", "override_coredump_limit", FALSE);
|
settings_add_bool("misc", "override_coredump_limit", FALSE);
|
||||||
|
settings_add_bool("misc", "quit_on_hup", FALSE);
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_RESOURCE_H
|
#ifdef HAVE_SYS_RESOURCE_H
|
||||||
getrlimit(RLIMIT_CORE, &orig_core_rlimit);
|
getrlimit(RLIMIT_CORE, &orig_core_rlimit);
|
||||||
|
Loading…
Reference in New Issue
Block a user