[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] connector: Check for POLLHUP on in_fd


From: Chris Townsend <christopher.townsend@xxxxxxxxxxxxx>

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@xxxxxxxxx>
---
 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);
-- 
2.14.1


Archive administrator: postmaster@lists.cynapses.org