diff options
author | Seb Boving <seb@google.com> | 2015-02-18 12:51:45 -0800 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2015-02-23 22:05:54 +0100 |
commit | 7ec798d3e73f3dac94a3c240545ebaf4daa189b4 (patch) | |
tree | 677c7b6241170d5ff2a0a096a7ff0867b10814b9 /src | |
parent | f32e5f219182e59b66e98096bbc4c46d0829e06f (diff) | |
download | libssh-7ec798d3e73f3dac94a3c240545ebaf4daa189b4.tar.gz libssh-7ec798d3e73f3dac94a3c240545ebaf4daa189b4.tar.xz libssh-7ec798d3e73f3dac94a3c240545ebaf4daa189b4.zip |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/poll.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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) |