diff options
author | Timo Weingärtner <timo@tiwe.de> | 2018-07-18 20:44:55 +0200 |
---|---|---|
committer | Timo Weingärtner <timo@tiwe.de> | 2018-07-18 20:44:55 +0200 |
commit | 663113f49fd46875f4dcd3a453f6de3f07c57330 (patch) | |
tree | dfe25c17bb5beb034101d303e8c7f33d52409e63 /ssh-agent-filter.C | |
parent | 101f47c7bf721a4104321075f93bdf723fc44bc6 (diff) | |
parent | cc7b883c67b78021c13df453abeb35d8d9055c35 (diff) | |
download | ssh-agent-filter-663113f49fd46875f4dcd3a453f6de3f07c57330.tar.gz |
Merge tag '0.5.1' into debian
0.5.1
Diffstat (limited to 'ssh-agent-filter.C')
-rw-r--r-- | ssh-agent-filter.C | 10 |
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 (...) { } |