From 25f31760aacde37493c21a8cfc4446093413d146 Mon Sep 17 00:00:00 2001 From: Alberto Aguirre Date: Mon, 26 Feb 2018 12:30:45 -0600 Subject: [PATCH] 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 Reviewed-by: Andreas Schneider --- src/connector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);