summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeb Boving <seb@google.com>2015-02-18 12:51:45 -0800
committerAris Adamantiadis <aris@0xbadc0de.be>2015-02-23 22:06:34 +0100
commit6b18f0b4b05f6c13ddfae2e95d10bdf34ed1c306 (patch)
tree4a08d9a55651a46b0f10debf6591edca017e1497
parent8f2eee6509a669dda51eb92e622fa935febfc7e5 (diff)
Locally restart ssh_poll() upon EINTR.
BUG: https://red.libssh.org/issues/186 Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be> Signed-off-by: Sebastien Boving <seb@google.com>
-rw-r--r--src/poll.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/poll.c b/src/poll.c
index 4e9f19f0..dfa687a9 100644
--- a/src/poll.c
+++ b/src/poll.c
@@ -597,11 +597,17 @@ int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout) {
ssh_poll_handle p;
socket_t fd;
int revents;
+ struct ssh_timestamp ts;
if (!ctx->polls_used)
return SSH_ERROR;
- rc = ssh_poll(ctx->pollfds, ctx->polls_used, timeout);
+ ssh_timestamp_init(&ts);
+ do {
+ int tm = ssh_timeout_update(&ts, timeout);
+ rc = ssh_poll(ctx->pollfds, ctx->polls_used, tm);
+ } while (rc == -1 && errno == EINTR);
+
if(rc < 0)
return SSH_ERROR;
if (rc == 0)