aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Aguirre <albaguirre@gmail.com>2018-02-26 12:30:45 -0600
committerAndreas Schneider <asn@cryptomilk.org>2018-03-07 15:47:03 +0100
commit25f31760aacde37493c21a8cfc4446093413d146 (patch)
treea12dd907de512e63e95fc1a79769ec110eb917ec
parentd11869bdb6df04c76e94b1b461ea5a519dcbddf1 (diff)
downloadlibssh-25f31760aacde37493c21a8cfc4446093413d146.tar.gz
libssh-25f31760aacde37493c21a8cfc4446093413d146.tar.xz
libssh-25f31760aacde37493c21a8cfc4446093413d146.zip
connector: Check for POLLHUP on in_fd
POLLHUP needs to be checked on in_fd, which may be a pipe. A pipe in Linux signals EOF through POLLHUP (see: http://www.greenend.org.uk/rjk/tech/poll.html) Without checking POLLHUP, a client could spin up indefinetely doing ssh_event_dopoll. Signed-off-by: Alberto Aguirre <albaguirre@gmail.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/connector.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/connector.c b/src/connector.c
index 6f15ee28..565e3100 100644
--- a/src/connector.c
+++ b/src/connector.c
@@ -370,7 +370,7 @@ static int ssh_connector_fd_cb(ssh_poll_handle p,
if (revents & POLLERR) {
ssh_connector_except(connector, fd);
- } else if((revents & POLLIN) && fd == connector->in_fd) {
+ } else if((revents & (POLLIN|POLLHUP)) && fd == connector->in_fd) {
ssh_connector_fd_in_cb(connector);
} else if((revents & POLLOUT) && fd == connector->out_fd) {
ssh_connector_fd_out_cb(connector);