aboutsummaryrefslogtreecommitdiff
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-06 11:11:12 +0200
commit563fbe4de8ee090b40b50415a86f9a3da16f46b0 (patch)
tree03080ec3c56aee324b11c190415c9e5647ecdeec /src/poll.c
parent39f962c91eb4575a65edc7d984ce3f1a699097b8 (diff)
downloadlibssh-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.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/poll.c b/src/poll.c
index f294a454..2b3c5ba2 100644
--- a/src/poll.c
+++ b/src/poll.c
@@ -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;