From 34f97998390b7be1febbb436f01482984062d7d6 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 14 Apr 2005 08:49:20 +0000 Subject: [PATCH] 2005-04-14 Marcus Brinkmann * wait-global.c (gpgme_wait): Use LI->ctx when checking a context in the list, not the user-provided CTX. --- gpgme/ChangeLog | 4 ++++ gpgme/wait-global.c | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index d993d473..ba448ef7 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,5 +1,9 @@ 2005-04-14 Marcus Brinkmann + * wait-global.c (gpgme_wait): Use LI->ctx when checking a context + in the list, not the user-provided CTX. + Reported by Igor Belyi . + * wait-global.c (gpgme_wait): If no context is found, and we should not hang, set *status to 0 and return NULL. Reported by Igor Belyi . diff --git a/gpgme/wait-global.c b/gpgme/wait-global.c index 24d75507..db422bf2 100644 --- a/gpgme/wait-global.c +++ b/gpgme/wait-global.c @@ -331,13 +331,15 @@ gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang) LOCK (ctx_list_lock); for (li = ctx_active_list; li; li = li->next) { - for (i = 0; i < ctx->fdt.size; i++) - if (ctx->fdt.fds[i].fd != -1) + gpgme_ctx_t actx = li->ctx; + + for (i = 0; i < actx->fdt.size; i++) + if (actx->fdt.fds[i].fd != -1) break; - if (i == ctx->fdt.size) + if (i == actx->fdt.size) { gpgme_error_t err = 0; - _gpgme_engine_io_event (ctx->engine, GPGME_EVENT_DONE, &err); + _gpgme_engine_io_event (actx->engine, GPGME_EVENT_DONE, &err); } } UNLOCK (ctx_list_lock);