mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Merge pull request #1169 from Pinguin1234/feature/close_on_sighup
Added option to quit in SIGHUP
This commit is contained in:
commit
f1647bdfa9
@ -6,7 +6,7 @@
|
||||
#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
|
||||
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
|
||||
|
||||
#define IRSSI_ABI_VERSION 25
|
||||
#define IRSSI_ABI_VERSION 26
|
||||
|
||||
#define DEFAULT_SERVER_ADD_PORT 6667
|
||||
#define DEFAULT_SERVER_ADD_TLS_PORT 6697
|
||||
|
@ -66,7 +66,7 @@ void wcwidth_wrapper_deinit(void);
|
||||
|
||||
int irssi_gui;
|
||||
int irssi_init_finished;
|
||||
int reload_config;
|
||||
int sighup_received;
|
||||
time_t client_start_time;
|
||||
|
||||
static char *irssi_dir, *irssi_config_file;
|
||||
@ -83,9 +83,9 @@ const char *get_irssi_config(void)
|
||||
return irssi_config_file;
|
||||
}
|
||||
|
||||
static void sig_reload_config(int signo)
|
||||
static void sig_hup(int signo)
|
||||
{
|
||||
reload_config = TRUE;
|
||||
sighup_received = TRUE;
|
||||
}
|
||||
|
||||
static void read_settings(void)
|
||||
@ -108,8 +108,7 @@ static void read_settings(void)
|
||||
sigemptyset (&act.sa_mask);
|
||||
act.sa_flags = 0;
|
||||
|
||||
/* reload config on SIGHUP */
|
||||
act.sa_handler = sig_reload_config;
|
||||
act.sa_handler = sig_hup;
|
||||
sigaction(SIGHUP, &act, NULL);
|
||||
|
||||
for (n = 0; n < sizeof(signals)/sizeof(signals[0]); n++) {
|
||||
@ -267,6 +266,7 @@ void core_init(void)
|
||||
|
||||
settings_add_str("misc", "ignore_signals", "");
|
||||
settings_add_bool("misc", "override_coredump_limit", FALSE);
|
||||
settings_add_bool("misc", "quit_on_hup", FALSE);
|
||||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
getrlimit(RLIMIT_CORE, &orig_core_rlimit);
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
extern int irssi_gui;
|
||||
extern int irssi_init_finished; /* TRUE after "irssi init finished" signal is sent */
|
||||
extern int reload_config; /* TRUE after received SIGHUP. */
|
||||
extern int sighup_received; /* TRUE after received SIGHUP. */
|
||||
extern time_t client_start_time;
|
||||
|
||||
void core_preinit(const char *path);
|
||||
|
@ -339,10 +339,15 @@ int main(int argc, char **argv)
|
||||
/* Does the same as g_main_run(main_loop), except we
|
||||
can call our dirty-checker after each iteration */
|
||||
while (!quitting) {
|
||||
if (reload_config) {
|
||||
/* SIGHUP received, do /RELOAD */
|
||||
reload_config = FALSE;
|
||||
signal_emit("command reload", 1, "");
|
||||
if (sighup_received) {
|
||||
sighup_received = FALSE;
|
||||
|
||||
if (settings_get_bool("quit_on_hup")) {
|
||||
signal_emit("gui exit", 0);
|
||||
}
|
||||
else {
|
||||
signal_emit("command reload", 1, "");
|
||||
}
|
||||
}
|
||||
|
||||
dirty_check();
|
||||
|
Loading…
x
Reference in New Issue
Block a user