diff options
author | rofl0r <retnyg@gmx.net> | 2011-08-06 10:31:43 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-08-06 11:11:12 +0200 |
commit | 563fbe4de8ee090b40b50415a86f9a3da16f46b0 (patch) | |
tree | 03080ec3c56aee324b11c190415c9e5647ecdeec /src/poll.c | |
parent | 39f962c91eb4575a65edc7d984ce3f1a699097b8 (diff) | |
download | libssh-563fbe4de8ee090b40b50415a86f9a3da16f46b0.tar.gz libssh-563fbe4de8ee090b40b50415a86f9a3da16f46b0.tar.xz libssh-563fbe4de8ee090b40b50415a86f9a3da16f46b0.zip |
channels: Fix checking for fatal errors.
We need this that we don't end up in and infinite poll loop.
Diffstat (limited to 'src/poll.c')
-rw-r--r-- | src/poll.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -612,11 +612,16 @@ int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout) { if (!ctx->pollfds[i].revents) { i++; } else { + int ret; + p = ctx->pollptrs[i]; fd = ctx->pollfds[i].fd; revents = ctx->pollfds[i].revents; - if (p->cb && p->cb(p, fd, revents, p->cb_data) < 0) { + if (p->cb && (ret = p->cb(p, fd, revents, p->cb_data)) < 0) { + if (ret == -2) { + return -1; + } /* the poll was removed, reload the used counter and start again */ used = ctx->polls_used; i=0; |