From 41a5ac15c741a50c4323f94ee62916b854cba3dc 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. --- trunk/gpgme/ChangeLog | 4 ++++ trunk/gpgme/wait-global.c | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index d993d47..ba448ef 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/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/trunk/gpgme/wait-global.c b/trunk/gpgme/wait-global.c index 24d7550..db422bf 100644 --- a/trunk/gpgme/wait-global.c +++ b/trunk/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); -- 2.26.2