[svn] gpgme - r1155 - trunk/gpgme
svn author marcus
cvs at cvs.gnupg.org
Wed Feb 22 12:44:16 CET 2006
Author: marcus
Date: 2006-02-22 12:44:16 +0100 (Wed, 22 Feb 2006)
New Revision: 1155
Modified:
trunk/gpgme/ChangeLog
trunk/gpgme/engine.c
Log:
2006-02-22 Marcus Brinkmann <marcus at g10code.de>
* engine.c (gpgme_engine_check_version): Reimplemented to allow
checking the version correctly even after changing the engine
information. Bug reported by St?\195?\169phane Corth?\195?\169sy.
Modified: trunk/gpgme/ChangeLog
===================================================================
--- trunk/gpgme/ChangeLog 2006-02-22 11:02:50 UTC (rev 1154)
+++ trunk/gpgme/ChangeLog 2006-02-22 11:44:16 UTC (rev 1155)
@@ -1,5 +1,9 @@
2006-02-22 Marcus Brinkmann <marcus at g10code.de>
+ * engine.c (gpgme_engine_check_version): Reimplemented to allow
+ checking the version correctly even after changing the engine
+ information. Bug reported by Stéphane Corthésy.
+
* rungpg.c (read_colon_line): Invoke colon preprocess handler if
it is set.
(colon_preprocessor_t): New type.
Modified: trunk/gpgme/engine.c
===================================================================
--- trunk/gpgme/engine.c 2006-02-22 11:02:50 UTC (rev 1154)
+++ trunk/gpgme/engine.c 2006-02-22 11:44:16 UTC (rev 1155)
@@ -106,14 +106,33 @@
gpgme_error_t
gpgme_engine_check_version (gpgme_protocol_t proto)
{
+ gpgme_error_t err;
+ gpgme_engine_info_t info;
int result;
- char *engine_version = engine_get_version (proto, NULL);
- result = _gpgme_compare_versions (engine_version,
- engine_get_req_version (proto));
- if (engine_version)
- free (engine_version);
+ LOCK (engine_info_lock);
+ info = engine_info;
+ if (!info)
+ {
+ /* Make sure it is initialized. */
+ UNLOCK (engine_info_lock);
+ err = gpgme_get_engine_info (&info);
+ if (err)
+ return err;
+ LOCK (engine_info_lock);
+ }
+
+ while (info && info->protocol != proto)
+ info = info->next;
+
+ if (!info)
+ result = 0;
+ else
+ result = _gpgme_compare_versions (info->version,
+ info->req_version);
+
+ UNLOCK (engine_info_lock);
return result ? 0 : gpg_error (GPG_ERR_INV_ENGINE);
}
More information about the Gnupg-commits
mailing list