summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm>2017-09-06 07:12:41 +0000
committernicm <nicm>2017-09-06 07:12:41 +0000
commit466066c3a1393bb2c485b0cfc616b5d9e0afc5f9 (patch)
tree28fcfd7c941eabc070fb5ae5c8d2821a1ec67de2
parenteadd79acec159a68db797521e361575d0c6ade20 (diff)
Do not attempt to use TIOCSWINSZ on a -1 file descriptor (possible if
the pane has already died).
-rw-r--r--server-client.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/server-client.c b/server-client.c
index 2263deca..0b4146a8 100644
--- a/server-client.c
+++ b/server-client.c
@@ -1069,7 +1069,7 @@ server_client_resize_force(struct window_pane *wp)
memset(&ws, 0, sizeof ws);
ws.ws_col = wp->sx;
ws.ws_row = wp->sy - 1;
- if (ioctl(wp->fd, TIOCSWINSZ, &ws) == -1)
+ if (wp->fd != -1 && ioctl(wp->fd, TIOCSWINSZ, &ws) == -1)
fatal("ioctl failed");
log_debug("%s: %%%u forcing resize", __func__, wp->id);
@@ -1095,7 +1095,7 @@ server_client_resize_event(__unused int fd, __unused short events, void *data)
memset(&ws, 0, sizeof ws);
ws.ws_col = wp->sx;
ws.ws_row = wp->sy;
- if (ioctl(wp->fd, TIOCSWINSZ, &ws) == -1)
+ if (wp->fd != -1 && ioctl(wp->fd, TIOCSWINSZ, &ws) == -1)
fatal("ioctl failed");
log_debug("%s: %%%u resize to %u,%u", __func__, wp->id, wp->sx, wp->sy);