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

Re: [PATCH] Locally restart ssh_poll() upon EINTR.


Anyone?

(I don't see my post on http://www.libssh.org/archive/libssh/2015-02/,
perhaps it didn't make it, but this should fix that.  Thanks!)


On Thu, Feb 12, 2015 at 2:28 PM, Sebastien Boving <seb@xxxxxxxxxx> wrote:

> BUG: https://red.libssh.org/issues/186
>
> Signed-off-by: Sebastien Boving <seb@xxxxxxxxxx>
> ---
>  src/poll.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/poll.c b/src/poll.c
> index 4e9f19f..dfa687a 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)
> --
> 2.2.0.rc0.207.ga3a616c
>
>

Follow-Ups:
Re: [PATCH] Locally restart ssh_poll() upon EINTR.Aris Adamantiadis <aris@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org