From 98e7fbb2acee0238381feea5d583fc439aae08e2 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 23 Jan 2017 10:09:43 +0000 Subject: Open /dev/ptm before pledge() and save it to be used for PTMGET later (this means inlining forkpty()). ok deraadt --- tmux.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tmux.c') diff --git a/tmux.c b/tmux.c index e80e2b06..d5e962df 100644 --- a/tmux.c +++ b/tmux.c @@ -43,6 +43,7 @@ struct hooks *global_hooks; struct timeval start_time; const char *socket_path; +int ptm_fd = -1; static __dead void usage(void); static char *make_label(const char *); @@ -258,6 +259,8 @@ main(int argc, char **argv) if (shellcmd != NULL && argc != 0) usage(); + if (pty_open(&ptm_fd) != 0) + errx(1, "open(\"/dev/ptm\""); if (pledge("stdio rpath wpath cpath flock fattr unix getpw sendfd " "recvfd proc exec tty ps", NULL) != 0) err(1, "pledge"); -- cgit v1.2.3