summaryrefslogtreecommitdiffstats
path: root/src/poll.c
diff options
context:
space:
mode:
authorrofl0r <retnyg@gmx.net>2011-08-06 10:31:43 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-08-07 12:46:47 +0200
commita1ef27c0b882d0791ab29584f015d1f8bee44996 (patch)
tree708657551f17d11310909cb8fc06d3724bd8f610 /src/poll.c
parentfb8f2cd11b938f0b1fe660df7630c0eee47b27ff (diff)
channels: Fix checking for fatal errors.
We need this that we don't end up in and infinite poll loop. (cherry picked from commit 563fbe4de8ee090b40b50415a86f9a3da16f46b0) Conflicts: src/poll.c
Diffstat (limited to 'src/poll.c')
-rw-r--r--src/poll.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/poll.c b/src/poll.c
index e5ab16c0..ca012d23 100644
--- a/src/poll.c
+++ b/src/poll.c
@@ -608,11 +608,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, 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;