summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Weingärtner <timo@tiwe.de>2018-05-10 17:50:04 +0200
committerTimo Weingärtner <timo@tiwe.de>2018-05-11 17:01:54 +0200
commitddea0ce92bad7e218be9ac46f76ff2c34fd43a15 (patch)
tree1149dfe578357e3178aa745c5959e0090d34cd2a
parentd731f74d7ccf56874953c395bcfcc93efdd70f00 (diff)
downloadssh-agent-filter-ddea0ce92bad7e218be9ac46f76ff2c34fd43a15.tar.gz
Partially revert "(re)unify client iostreams"
This partially reverts commit a42c87e6a761a56ebc63cd7728fa2126b2e8805f.
-rw-r--r--ssh-agent-filter.C10
1 files changed, 7 insertions, 3 deletions
diff --git a/ssh-agent-filter.C b/ssh-agent-filter.C
index 74b15ab..307be1f 100644
--- a/ssh-agent-filter.C
+++ b/ssh-agent-filter.C
@@ -567,11 +567,15 @@ void handle_client (int const sock) try {
if (fcntl(sock, F_SETFL, fcntl(sock, F_GETFL) & ~O_NONBLOCK))
throw system_error(errno, system_category(), "fcntl");
- io::stream<io::file_descriptor> client{sock, io::close_handle};
- arm(client);
+ // we could use only one streambuf and iostream but when
+ // switching from read to write an lseek call is made that
+ // fails with ESPIPE and causes an exception
+ io::stream<io::file_descriptor_source> client_in{sock, io::close_handle};
+ io::stream<io::file_descriptor_sink> client_out{sock, io::never_close_handle};
+ arm(client_out);
for (;;)
- client << handle_request(rfc4251::string{client}) << flush;
+ client_out << handle_request(rfc4251::string{client_in}) << flush;
} catch (...) {
}