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 /window.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 'window.c')
-rw-r--r-- | window.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.106 2009-09-02 01:08:32 tcunha Exp $ */ +/* $Id: window.c,v 1.107 2009-09-16 12:36:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -452,6 +452,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) @@ -482,7 +483,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)); @@ -491,6 +492,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); |