1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-08 19:02:06 +03:00

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>
This commit is contained in:
Seb Boving
2015-02-18 12:51:45 -08:00
committed by Aris Adamantiadis
parent 8f2eee6509
commit 6b18f0b4b0

View File

@@ -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)