summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/client.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-09-23 06:12:58 +0000
committernicm <nicm@openbsd.org>2009-09-23 06:12:58 +0000
commitb588e6bc1283674389e11702e39165a4a0240532 (patch)
tree0ee3b8e4564131003d0d9af77b86243ba8c98b00 /usr.bin/tmux/client.c
parentDon't attempt to open() the tty path, rely on the client sending its stdin fd (diff)
downloadwireguard-openbsd-b588e6bc1283674389e11702e39165a4a0240532.tar.xz
wireguard-openbsd-b588e6bc1283674389e11702e39165a4a0240532.zip
Trim some code by moving the ioctl(TIOCGWINSZ) after SIGWINCH from the client
into the server. This is another (the second of four) protocol version changes coming this morning, so again the server should be killed before upgrading.
Diffstat (limited to 'usr.bin/tmux/client.c')
-rw-r--r--usr.bin/tmux/client.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c
index a152687f212..eda669fa41f 100644
--- a/usr.bin/tmux/client.c
+++ b/usr.bin/tmux/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.19 2009/09/23 06:05:02 nicm Exp $ */
+/* $OpenBSD: client.c,v 1.20 2009/09/23 06:12:58 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,7 +34,6 @@
#include "tmux.h"
void client_send_environ(struct client_ctx *);
-void client_handle_winch(struct client_ctx *);
int
client_init(char *path, struct client_ctx *cctx, int cmdflags, int flags)
@@ -100,8 +99,6 @@ server_started:
if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1)
fatal("ioctl(TIOCGWINSZ)");
data.flags = flags;
- data.sx = ws.ws_col;
- data.sy = ws.ws_row;
if (getcwd(data.cwd, sizeof data.cwd) == NULL)
*data.cwd = '\0';
@@ -169,8 +166,10 @@ client_main(struct client_ctx *cctx)
waitpid(WAIT_ANY, NULL, WNOHANG);
sigchld = 0;
}
- if (sigwinch)
- client_handle_winch(cctx);
+ if (sigwinch) {
+ client_write_server(cctx, MSG_RESIZE, NULL, 0);
+ sigwinch = 0;
+ }
if (sigcont) {
siginit();
client_write_server(cctx, MSG_WAKEUP, NULL, 0);
@@ -238,22 +237,6 @@ out:
}
}
-void
-client_handle_winch(struct client_ctx *cctx)
-{
- struct msg_resize_data data;
- struct winsize ws;
-
- if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1)
- fatal("ioctl failed");
-
- data.sx = ws.ws_col;
- data.sy = ws.ws_row;
- client_write_server(cctx, MSG_RESIZE, &data, sizeof data);
-
- sigwinch = 0;
-}
-
int
client_msg_dispatch(struct client_ctx *cctx)
{