aboutsummaryrefslogtreecommitdiff
path: root/src/bind.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2019-01-14 11:32:28 +0100
committerAndreas Schneider <asn@cryptomilk.org>2019-01-15 15:44:50 +0100
commit86849c088365d68d29ebc72813905309487dc8a9 (patch)
treeb95d8f8beb52b2941f1afecb1e74d4922362c64b /src/bind.c
parent0e9add9a89fef3db585c3a5d1f94fe1712318d67 (diff)
downloadlibssh-86849c088365d68d29ebc72813905309487dc8a9.tar.gz
libssh-86849c088365d68d29ebc72813905309487dc8a9.tar.xz
libssh-86849c088365d68d29ebc72813905309487dc8a9.zip
bind: Check for POLLRDHUP on the server if available
This is a feature on modern Linux. Thanks to Ludovic Court├Ęs <ludo@gnu.org> for the pointer. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/bind.c')
-rw-r--r--src/bind.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/bind.c b/src/bind.c
index a91b3ad8..4e28f774 100644
--- a/src/bind.c
+++ b/src/bind.c
@@ -345,11 +345,18 @@ static int ssh_bind_poll_callback(ssh_poll_handle sshpoll,
*/
ssh_poll_handle ssh_bind_get_poll(ssh_bind sshbind)
{
+ short events = POLLIN;
+
if (sshbind->poll) {
return sshbind->poll;
}
+
+#ifdef POLLRDHUP
+ events |= POLLRDHUP;
+#endif /* POLLRDHUP */
+
sshbind->poll = ssh_poll_new(sshbind->bindfd,
- POLLIN,
+ events,
ssh_bind_poll_callback,
sshbind);