aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-09-16 12:35:04 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-09-16 12:35:04 +0000
commit5c60162e3c4f8ac9deede6c0fb5a21930d92e3b4 (patch)
tree16e91d61eed65cf74d3987cf9b7cd08ffea48288 /window.c
parenta6dd9e8e7eb0d7734b0905a97f6e8b0087a2e09c (diff)
downloadrtmux-5c60162e3c4f8ac9deede6c0fb5a21930d92e3b4.tar.gz
rtmux-5c60162e3c4f8ac9deede6c0fb5a21930d92e3b4.tar.bz2
rtmux-5c60162e3c4f8ac9deede6c0fb5a21930d92e3b4.zip
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.
Diffstat (limited to 'window.c')
-rw-r--r--window.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/window.c b/window.c
index 62b1f487..5683f174 100644
--- a/window.c
+++ b/window.c
@@ -454,6 +454,7 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
struct environ_entry *envent;
const char *ptr;
struct timeval tv;
+ struct termios tio2;
u_int i;
if (wp->fd != -1)
@@ -484,7 +485,7 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
tv.tv_usec = NAME_INTERVAL * 1000L;
timeradd(&wp->window->name_timer, &tv, &wp->window->name_timer);
- switch (wp->pid = forkpty(&wp->fd, wp->tty, tio, &ws)) {
+ switch (wp->pid = forkpty(&wp->fd, wp->tty, NULL, &ws)) {
case -1:
wp->fd = -1;
xasprintf(cause, "%s: %s", cmd, strerror(errno));
@@ -493,6 +494,14 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
if (chdir(wp->cwd) != 0)
chdir("/");
+ if (tcgetattr(STDIN_FILENO, &tio2) != 0)
+ fatal("tcgetattr failed");
+ if (tio != NULL)
+ memcpy(tio2.c_cc, tio->c_cc, sizeof tio2.c_cc);
+ tio2.c_cc[VERASE] = '\177';
+ if (tcsetattr(STDIN_FILENO, TCSANOW, &tio2) != 0)
+ fatal("tcgetattr failed");
+
ARRAY_INIT(&varlist);
for (varp = environ; *varp != NULL; varp++) {
var = xstrdup(*varp);