summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-08-12 06:04:29 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-08-12 06:04:29 +0000
commitb3ac71bc32ab11426adec3daf51dc056c3845faa (patch)
treeedf5746dd8f7f8ca37288150154fd542e14bccfb /usr.bin/tmux/client.c
parent411ef752422abc2ba1045c1938d1b120b6582a3f (diff)
imsg closes the fd after sending, so dup() STDIN_FILENO before passing it to
the parent, otherwise TIOCGWINSZ will fail when the window is resized (that could actually be moved into the server but this is more future-proof and avoids breaking the protocol).
Diffstat (limited to 'usr.bin/tmux/client.c')
-rw-r--r--usr.bin/tmux/client.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c
index 669783624c5..b30465cc2f1 100644
--- a/usr.bin/tmux/client.c
+++ b/usr.bin/tmux/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.13 2009/08/11 21:28:11 nicm Exp $ */
+/* $OpenBSD: client.c,v 1.14 2009/08/12 06:04:28 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -44,7 +44,7 @@ client_init(char *path, struct client_ctx *cctx, int cmdflags, int flags)
struct msg_identify_data data;
struct winsize ws;
size_t size;
- int fd, mode;
+ int fd, fd2, mode;
char *name, *term;
char rpathbuf[MAXPATHLEN];
@@ -119,8 +119,9 @@ server_started:
if (strlcpy(data.tty, name, sizeof data.tty) >= sizeof data.tty)
fatalx("ttyname failed");
+ fd2 = dup(STDIN_FILENO);
imsg_compose(&cctx->ibuf, MSG_IDENTIFY,
- PROTOCOL_VERSION, -1, STDIN_FILENO, &data, sizeof data);
+ PROTOCOL_VERSION, -1, fd2, &data, sizeof data);
}
return (0);