summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-08-12 06:04:28 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-08-12 06:04:28 +0000
commit85e8b70625c415e25b332e59152f6383a49afa5d (patch)
treee0c8d20914a1bb23c0b4d8fdd0525a44ffd0806f /client.c
parente0a19abb99aebcee544c451ff5e99f6a59d42d0c (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 'client.c')
-rw-r--r--client.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/client.c b/client.c
index 0bbe6056..359d9482 100644
--- a/client.c
+++ b/client.c
@@ -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);