Open /dev/ptm before pledge() and save it to be used for PTMGET later

(this means inlining forkpty()).

ok deraadt
This commit is contained in:
nicm
2017-01-23 10:09:43 +00:00
parent 4ede35c48c
commit 98e7fbb2ac
6 changed files with 79 additions and 1 deletions

View File

@ -886,7 +886,7 @@ window_pane_spawn(struct window_pane *wp, int argc, char **argv,
ws.ws_col = screen_size_x(&wp->base);
ws.ws_row = screen_size_y(&wp->base);
switch (wp->pid = forkpty(&wp->fd, wp->tty, NULL, &ws)) {
switch (wp->pid = pty_fork(ptm_fd, &wp->fd, wp->tty, sizeof wp->tty, &ws)) {
case -1:
wp->fd = -1;
xasprintf(cause, "%s: %s", cmd, strerror(errno));