summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authornicm <nicm>2020-05-26 08:41:47 +0000
committernicm <nicm>2020-05-26 08:41:47 +0000
commitea610a311902b56c6466d79332592ab7f3dc501a (patch)
tree5105e83b6490c4c95508648bc94ffa2f654dee66 /client.c
parent6f03e49e68dfe0d9c0c7d49079c4383b26aca916 (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 'client.c')
-rw-r--r--client.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/client.c b/client.c
index 841e581e..d1a31de7 100644
--- a/client.c
+++ b/client.c
@@ -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);