summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-05-26 08:41:48 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-05-26 08:41:48 +0000
commit1e8cd9d00a45c149cd96a0b680b813074d4ec33e (patch)
treeb09ccb0db05b5f460cc3e11f072c1c3850977f6f /usr.bin/tmux/client.c
parent4640a86bb29bf26fe50d36e66510d01827b9bca8 (diff)
Pass the stdout file descriptor from the client as well as stdin and use
them for control clients directly instead of passing everything via the client.
Diffstat (limited to 'usr.bin/tmux/client.c')
-rw-r--r--usr.bin/tmux/client.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c
index 5565e78db8d..74feea6ba27 100644
--- a/usr.bin/tmux/client.c
+++ b/usr.bin/tmux/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.144 2020/05/08 14:15:11 nicm Exp $ */
+/* $OpenBSD: client.c,v 1.145 2020/05/26 08:41:47 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -402,6 +402,8 @@ client_main(struct event_base *base, int argc, char **argv, int flags, int feat)
} else if (client_exitreason != CLIENT_EXIT_NONE)
fprintf(stderr, "%s\n", client_exit_message());
setblocking(STDIN_FILENO, 1);
+ setblocking(STDOUT_FILENO, 1);
+ setblocking(STDERR_FILENO, 1);
return (client_exitval);
}
@@ -429,6 +431,9 @@ client_send_identify(const char *ttynam, const char *cwd, int feat)
if ((fd = dup(STDIN_FILENO)) == -1)
fatal("dup failed");
proc_send(client_peer, MSG_IDENTIFY_STDIN, fd, NULL, 0);
+ if ((fd = dup(STDOUT_FILENO)) == -1)
+ fatal("dup failed");
+ proc_send(client_peer, MSG_IDENTIFY_STDOUT, fd, NULL, 0);
pid = getpid();
proc_send(client_peer, MSG_IDENTIFY_CLIENTPID, -1, &pid, sizeof pid);