diff options
author | 2017-01-23 10:09:43 +0000 | |
---|---|---|
committer | 2017-01-23 10:09:43 +0000 | |
commit | b6ec3d9f760fdd32867a62fe96cf8f207cf15eb8 (patch) | |
tree | 42161e73feb1dca4ce955c8f2678b01b22442cb5 /usr.bin/tmux/tmux.c | |
parent | check EAGAIN in the correct place, (diff) | |
download | wireguard-openbsd-b6ec3d9f760fdd32867a62fe96cf8f207cf15eb8.tar.xz wireguard-openbsd-b6ec3d9f760fdd32867a62fe96cf8f207cf15eb8.zip |
Open /dev/ptm before pledge() and save it to be used for PTMGET later
(this means inlining forkpty()).
ok deraadt
Diffstat (limited to 'usr.bin/tmux/tmux.c')
-rw-r--r-- | usr.bin/tmux/tmux.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index 5e4b4d7f741..ccc0a0795bb 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.175 2017/01/15 20:48:41 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.176 2017/01/23 10:09:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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"); |