diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-09-16 12:36:28 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-09-16 12:36:28 +0000 |
commit | 15b643fc119221658ca3e9c6718eeb88ffcbe47a (patch) | |
tree | 21c2d4ebd4565117a9a4d9ed7c98f84326849f07 /session.c | |
parent | 150fba5ecdb3fedd8aed71ee65fb8cc6b0354070 (diff) | |
download | rtmux-15b643fc119221658ca3e9c6718eeb88ffcbe47a.tar.gz rtmux-15b643fc119221658ca3e9c6718eeb88ffcbe47a.tar.bz2 rtmux-15b643fc119221658ca3e9c6718eeb88ffcbe47a.zip |
Sync from OpenBSD:
==
Rather than constructing an entire termios struct from ttydefaults.h, just let
forkpty do it and then alter the bits that should be changed after fork. A
little neater and more portable.
==
This should fix problems caused by glibc's broken ttydefaults.h file.
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $Id: session.c,v 1.65 2009-09-07 23:59:19 tcunha Exp $ */ +/* $Id: session.c,v 1.66 2009-09-16 12:36:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -138,7 +138,12 @@ session_create(const char *name, const char *cmd, const char *cwd, environ_init(&s->environ); if (env != NULL) environ_copy(env, &s->environ); - memcpy(&s->tio, tio, sizeof s->tio); + + s->tio = NULL; + if (tio != NULL) { + s->tio = xmalloc(sizeof *s->tio); + memcpy(s->tio, tio, sizeof *s->tio); + } s->sx = sx; s->sy = sy; @@ -181,6 +186,9 @@ session_destroy(struct session *s) while (!ARRAY_EMPTY(&sessions) && ARRAY_LAST(&sessions) == NULL) ARRAY_TRUNC(&sessions, 1); + if (s->tio != NULL) + xfree(s->tio); + session_alert_cancel(s, NULL); environ_free(&s->environ); options_free(&s->options); @@ -236,7 +244,7 @@ session_new(struct session *s, hlimit = options_get_number(&s->options, "history-limit"); w = window_create( - name, cmd, shell, cwd, &env, &s->tio, s->sx, s->sy, hlimit, cause); + name, cmd, shell, cwd, &env, s->tio, s->sx, s->sy, hlimit, cause); if (w == NULL) { environ_free(&env); return (NULL); |