diff options
author | Timo Sirainen <cras@irssi.org> | 2001-11-20 20:29:45 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-11-20 20:29:45 +0000 |
commit | b24629822e0e4ee5338e7d795b4374cc68ab2e21 (patch) | |
tree | 32f8ad4990155c884dbaf02c7f02da9d96cb33e4 /src/core/session.c | |
parent | c355002886a4f08f3a9194a5c2ceb9a18857bc7b (diff) | |
download | irssi-b24629822e0e4ee5338e7d795b4374cc68ab2e21.zip |
/UPGRADE: waited pids are now transferred to new client so we don't leave
zombie processes.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2129 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/session.c')
-rw-r--r-- | src/core/session.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/core/session.c b/src/core/session.c index 1b52f40a..c80c1607 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -23,6 +23,7 @@ #include "commands.h" #include "args.h" #include "net-sendbuffer.h" +#include "pidwait.h" #include "lib-config/iconfig.h" #include "chat-protocols.h" @@ -102,8 +103,7 @@ static void cmd_upgrade(const char *data) config_write(session, NULL, -1); config_close(session); - /* irssi -! --session ~/.irssi/session - data may contain some other program as well, like + /* data may contain some other program as well, like /UPGRADE /usr/bin/screen irssi */ str = g_strdup_printf("%s --noconnect --session=%s --home=%s --config=%s", data, session_file, get_irssi_dir(), get_irssi_config()); @@ -224,22 +224,40 @@ static void session_restore_server(CONFIG_NODE *node) static void sig_session_save(CONFIG_REC *config) { CONFIG_NODE *node; + GSList *tmp; + GString *str; + /* save servers */ node = config_node_traverse(config, "(servers", TRUE); while (servers != NULL) session_save_server(servers->data, config, node); + + /* save pids */ + str = g_string_new(NULL); + for (tmp = pidwait_get_pids(); tmp != NULL; tmp = tmp->next) + g_string_sprintfa(str, "%d ", GPOINTER_TO_INT(tmp->data)); + config_node_set_str(config, config->mainnode, "pids", str->str); + g_string_free(str, TRUE); } static void sig_session_restore(CONFIG_REC *config) { CONFIG_NODE *node; GSList *tmp; + char **pids, **pid; + /* restore servers */ node = config_node_traverse(config, "(servers", FALSE); if (node != NULL) { for (tmp = node->value; tmp != NULL; tmp = config_node_next(tmp)) session_restore_server(tmp->data); } + + /* restore pids (so we don't leave zombies) */ + pids = g_strsplit(config_node_get_str(config->mainnode, "pids", ""), " ", -1); + for (pid = pids; *pid != NULL; pid++) + pidwait_add(atoi(*pid)); + g_strfreev(pids); } static void sig_init_finished(void) |