1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

A few more updates.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2071 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-11-19 01:54:02 +00:00 committed by cras
parent bbbb36cf19
commit a1b151d8d3

View File

@ -45,7 +45,7 @@ static void cmd_upgrade(const char *data)
GSList *file_handles;
const char *args[10];
char *session_file;
int pid, n;
int n;
if (*data == '\0')
data = irssi_binary;
@ -64,26 +64,17 @@ static void cmd_upgrade(const char *data)
config_write(session, NULL, -1);
config_close(session);
/* start it .. */
pid = fork();
if (pid == -1)
cmd_return_error(CMDERR_ERRNO);
if (pid == 0) {
/* we're the child - we want to send the server connections
to the new binary here */
g_free(session_file);
exit(0);
} else {
/* we're the old process - exec() the new binary here so
the TTY won't get lost */
/* Cleanup the terminal etc. */
signal_emit("session clean", 0);
/* close the file handles we don't want to transfer to new client */
for (n = 3; n < 256; n++) {
if (g_slist_find(file_handles, GINT_TO_POINTER(n)) == NULL)
close(n);
}
g_slist_free(file_handles),
/* irssi --session ~/.irssi/session.<pid> -! */
args[0] = data;
args[1] = "--session";
args[2] = session_file;
@ -93,7 +84,6 @@ static void cmd_upgrade(const char *data)
fprintf(stderr, "exec: %s: %s\n", args[0], g_strerror(errno));
_exit(-1);
}
}
static void session_save_server(SERVER_REC *server, CONFIG_REC *config,