aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Weingärtner <timo@tiwe.de>2016-08-23 22:03:43 +0200
committerTimo Weingärtner <timo@tiwe.de>2016-08-23 22:03:43 +0200
commitdc582af6e7a1e645402f333e200b8ff718de1b48 (patch)
treebfddd471c2065316072cf821637bf3d522cfe84f
parentaf7125b71663fafb61fb2e097a34695bab895b01 (diff)
downloadssh-agent-filter-dc582af6e7a1e645402f333e200b8ff718de1b48.tar.gz
clear O_NONBLOCK on client sockets
on *BSD client sockets inherit flags from the listening socket
-rw-r--r--ssh-agent-filter.C3
1 files changed, 3 insertions, 0 deletions
diff --git a/ssh-agent-filter.C b/ssh-agent-filter.C
index 1dcbb5c..30aaf9a 100644
--- a/ssh-agent-filter.C
+++ b/ssh-agent-filter.C
@@ -497,6 +497,9 @@ rfc4251::string handle_request (rfc4251::string const & r) {
}
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);