summaryrefslogtreecommitdiff
path: root/src/core/session.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-11-19 01:54:02 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-11-19 01:54:02 +0000
commita1b151d8d32306a5793f144ee14164c4d3488470 (patch)
treedc6dfb37fec4fa0307b7d4396e62dcd659d206dc /src/core/session.c
parentbbbb36cf1974ec63375915c081998cdd2ad881b0 (diff)
downloadirssi-a1b151d8d32306a5793f144ee14164c4d3488470.zip
A few more updates.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2071 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/session.c')
-rw-r--r--src/core/session.c48
1 files changed, 19 insertions, 29 deletions
diff --git a/src/core/session.c b/src/core/session.c
index 1f990972..c773c37d 100644
--- a/src/core/session.c
+++ b/src/core/session.c
@@ -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,36 +64,26 @@ 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);
+ /* Cleanup the terminal etc. */
+ signal_emit("session clean", 0);
- 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 */
- signal_emit("session clean", 0);
- for (n = 3; n < 256; n++) {
- if (g_slist_find(file_handles, GINT_TO_POINTER(n)) == NULL)
- close(n);
- }
- g_slist_free(file_handles),
-
- args[0] = data;
- args[1] = "--session";
- args[2] = session_file;
- args[3] = "-!";
- args[4] = NULL;
- execvp(args[0], (char **) args);
-
- fprintf(stderr, "exec: %s: %s\n", args[0], g_strerror(errno));
- _exit(-1);
+ /* 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;
+ args[3] = "-!";
+ args[4] = NULL;
+ execvp(args[0], (char **) args);
+
+ fprintf(stderr, "exec: %s: %s\n", args[0], g_strerror(errno));
+ _exit(-1);
}
static void session_save_server(SERVER_REC *server, CONFIG_REC *config,