summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2020-04-27 09:33:46 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2020-04-27 09:33:46 +0100
commit5811dd7ceb4d29c9871399047522adb22ee77ece (patch)
tree74fc570f3331dadc2e953210082e9d3d824da7b1 /client.c
parentf3d6d4e80251519577c52212e9fff1883abb51a5 (diff)
Do not close stdout file descriptor in control mode since it will be needed for
printing the exit messages.
Diffstat (limited to 'client.c')
-rw-r--r--client.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/client.c b/client.c
index 108873e7..4e7f7dcc 100644
--- a/client.c
+++ b/client.c
@@ -520,7 +520,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 */
}
}
@@ -675,7 +675,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) {