gpgme: prevent double-initialization by unit test
This contribution is related to .
@@ -546,10 +546,18 @@ cleanup:
return returnValue;
}
-int elektraGpgmeOpen (ELEKTRA_UNUSED Plugin * handle, ELEKTRA_UNUSED Key * errorKey)
+int elektraGpgmeOpen (Plugin * handle, Key * errorKey)
{
gpgme_error_t err;
+ // if the plugin is used by the unit test, initialization of libgpgme is done by the test code
+ KeySet * pluginConfig = elektraPluginGetConfig (handle);
+ if (inTestMode (pluginConfig))
+ {
+ return 1; // success
+ }
+
+ // initialize libgpgme
gpgme_check_version (NULL);
// NOTE the code below is recommended by the gpgme manual
// gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
