aboutsummaryrefslogtreecommitdiffstats
path: root/branches/gpgme-1-0-branch/gpgme/wait-global.c
diff options
context:
space:
mode:
Diffstat (limited to 'branches/gpgme-1-0-branch/gpgme/wait-global.c')
-rw-r--r--branches/gpgme-1-0-branch/gpgme/wait-global.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/branches/gpgme-1-0-branch/gpgme/wait-global.c b/branches/gpgme-1-0-branch/gpgme/wait-global.c
index 6d75d3d1..f3a5b430 100644
--- a/branches/gpgme-1-0-branch/gpgme/wait-global.c
+++ b/branches/gpgme-1-0-branch/gpgme/wait-global.c
@@ -1,6 +1,6 @@
/* wait-global.c
Copyright (C) 2000 Werner Koch (dd9jn)
- Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
+ Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
This file is part of GPGME.
@@ -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);
@@ -350,6 +352,12 @@ gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang)
ctx = dctx;
hang = 0;
}
+ else if (!hang)
+ {
+ ctx = NULL;
+ if (status)
+ *status = 0;
+ }
}
}
while (hang);