diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-08-14 21:26:07 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-08-14 21:26:07 +0000 |
commit | 1063e5d0e4abda89934b664a71737a32e278b4e3 (patch) | |
tree | 2d2910e8aa219b834127e875faa52291fc42ce72 | |
parent | 7f77c395e38b35efa757f83037a051fea0fcd27d (diff) | |
download | rtmux-1063e5d0e4abda89934b664a71737a32e278b4e3.tar.gz rtmux-1063e5d0e4abda89934b664a71737a32e278b4e3.tar.bz2 rtmux-1063e5d0e4abda89934b664a71737a32e278b4e3.zip |
Sync OpenBSD patchset 248:
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).
-rw-r--r-- | client.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $Id: client.c,v 1.63 2009-08-14 21:23:20 tcunha Exp $ */ +/* $Id: client.c,v 1.64 2009-08-14 21:26:07 tcunha 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; #ifdef HAVE_SETPROCTITLE char rpathbuf[MAXPATHLEN]; @@ -123,8 +123,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); |