summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-04-27 08:35:09 +0000
committernicm <nicm@openbsd.org>2020-04-27 08:35:09 +0000
commitadf814f985f38cb9f8f69d7d80a475c7737626cc (patch)
tree93b8208a05c3ab90ac07447dd6f8e29cd73e200f
parentOffload CCMP (WPA2) encryption and decryption to athn(4) hardware. (diff)
downloadwireguard-openbsd-adf814f985f38cb9f8f69d7d80a475c7737626cc.tar.xz
wireguard-openbsd-adf814f985f38cb9f8f69d7d80a475c7737626cc.zip
Do not close the stdout file descriptor in control mode as it will be
needed for printing the exit messages. Fixes a bug when detaching with iTerm2.
-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 351002a14d0..014ba7130a1 100644
--- a/usr.bin/tmux/client.c
+++ b/usr.bin/tmux/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.142 2020/04/20 13:25:36 nicm Exp $ */
+/* $OpenBSD: client.c,v 1.143 2020/04/27 08:35:09 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -518,7 +518,7 @@ client_write_open(void *data, size_t datalen)
errno = EBADF;
else {
cf->fd = dup(msg->fd);
- if (client_flags & CLIENT_CONTROL)
+ if (~client_flags & CLIENT_CONTROL)
close(msg->fd); /* can only be used once */
}
}
@@ -673,7 +673,8 @@ client_read_open(void *data, size_t datalen)
errno = EBADF;
else {
cf->fd = dup(msg->fd);
- close(msg->fd); /* can only be used once */
+ if (~client_flags & CLIENT_CONTROL)
+ close(msg->fd); /* can only be used once */
}
}
if (cf->fd == -1) {