diff options
author | Werner Koch <[email protected]> | 2014-01-07 12:32:08 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2014-01-07 12:32:08 +0000 |
commit | 121efcc5618374a1b4450b1d6a18bb3c35edb1fd (patch) | |
tree | 9d11e5aa35195cd3836bc5df7016917f2877075a /src/gpgme.c | |
parent | Print the full PATH in the log if gpg was not found. (diff) | |
download | gpgme-121efcc5618374a1b4450b1d6a18bb3c35edb1fd.tar.gz gpgme-121efcc5618374a1b4450b1d6a18bb3c35edb1fd.zip |
Make gpgme_new return a proper error if no engines are installed.
* src/engine.c (gpgme_get_engine_info): Improve error handling.
(_gpgme_engine_info_copy): Ditto.
* src/gpgme.c (gpgme_new): Return error GPG_ERR_NO_ENGINE.
Diffstat (limited to 'src/gpgme.c')
-rw-r--r-- | src/gpgme.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gpgme.c b/src/gpgme.c index 4a8afa96..3d00018f 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -86,6 +86,7 @@ gpgme_set_global_flag (const char *name, const char *value) gpgme_error_t gpgme_new (gpgme_ctx_t *r_ctx) { + gpgme_error_t err; gpgme_ctx_t ctx; TRACE_BEG (DEBUG_CTX, "gpgme_new", r_ctx); @@ -101,11 +102,13 @@ gpgme_new (gpgme_ctx_t *r_ctx) INIT_LOCK (ctx->lock); - _gpgme_engine_info_copy (&ctx->engine_info); - if (!ctx->engine_info) + err = _gpgme_engine_info_copy (&ctx->engine_info); + if (!err && !ctx->engine_info) + err = gpg_error (GPG_ERR_NO_ENGINE); + if (err) { free (ctx); - return TRACE_ERR (gpg_error_from_syserror ()); + return TRACE_ERR (err); } ctx->keylist_mode = GPGME_KEYLIST_MODE_LOCAL; |