diff options
author | Marcus Brinkmann <[email protected]> | 2002-06-28 01:11:20 +0000 |
---|---|---|
committer | Marcus Brinkmann <[email protected]> | 2002-06-28 01:11:20 +0000 |
commit | 3ccd2790b329087073bac2e9bbc6fa9355825d42 (patch) | |
tree | 33dcce8fe8eabd2d3a4849ddefcb54db43fd5269 /gpgme/trustlist.c | |
parent | doc/ (diff) | |
download | gpgme-3ccd2790b329087073bac2e9bbc6fa9355825d42.tar.gz gpgme-3ccd2790b329087073bac2e9bbc6fa9355825d42.zip |
2002-06-28 Marcus Brinkmann <[email protected]>
* ops.h (_gpgme_wait_on_condition): Remove HANG argument from
prototype and change return type to GpgmeError.
(_gpgme_wait_one): New prototype.
* wait.c (gpgme_wait): Replace with the meat from
_gpgme_wait_on_condition here, and remove the support for
conditions.
(_gpgme_wait_on_condition): Remove HANG argument from prototype
and change return type to GpgmeError. Replace with meat from
_gpgme_wait_one and add support for conditions.
(_gpgme_wait_one): Just call _gpgme_wait_on_condition without
condition.
* keylist.c (gpgme_op_keylist_ext_start): Always use our own FD
table (eg use synchronous mode).
(gpgme_op_keylist_next): Remove HANG argument from
_gpgme_wait_on_condition. Check its return value.
* trustlist.c (gpgme_op_trustlist_start): Always use our own FD
table (eg use synchronous mode).
(gpgme_op_trustlist_next): Remove HANG argument from
_gpgme_wait_on_condition. Check its return value.
Diffstat (limited to '')
-rw-r--r-- | gpgme/trustlist.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/gpgme/trustlist.c b/gpgme/trustlist.c index 7270e1c1..3d10e511 100644 --- a/gpgme/trustlist.c +++ b/gpgme/trustlist.c @@ -167,7 +167,9 @@ gpgme_op_trustlist_start (GpgmeCtx ctx, const char *pattern, int max_level) if (!pattern || !*pattern) return mk_error (Invalid_Value); - err = _gpgme_op_reset (ctx, 0); + /* Trustlist operations are always "synchronous" in the sense that + we don't add ourself to the global FD table. */ + err = _gpgme_op_reset (ctx, 1); if (err) goto leave; @@ -209,11 +211,26 @@ gpgme_op_trustlist_next (GpgmeCtx ctx, GpgmeTrustItem *r_item) if (!ctx->trust_queue) { - _gpgme_wait_on_condition (ctx, 1, &ctx->key_cond); - if (ctx->error) - return ctx->error; + GpgmeError err = _gpgme_wait_on_condition (ctx, &ctx->key_cond); + if (err) + { + ctx->pending = 0; + return err; + } + if (!ctx->pending) + { + /* The operation finished. Because not all keys might have + been returned to the caller yet, we just reset the + pending flag to 1. This will cause us to call + _gpgme_wait_on_condition without any active file + descriptors, but that is a no-op, so it is safe. */ + ctx->pending = 1; + } if (!ctx->key_cond) - return mk_error (EOF); + { + ctx->pending = 0; + return mk_error (EOF); + } ctx->key_cond = 0; assert (ctx->trust_queue); } |