GPGME_DEBUG on Android, which makes env vars hard
wk at gnupg.org
Tue Sep 25 16:13:16 CEST 2012
On Tue, 4 Sep 2012 19:58, hans at guardianproject.info said:
> Another idea would be for setting this from a conf file somewhere, but
> I'm not sure if there is a gpgme conf file.
I just pushed a new function to set debugging.
-- Function: int gpgme_set_global_flag (const char *NAME,
const char *VALUE)
On some systems it is not easy to set environment variables and
thus hard to use GPGME's internal trace facility for debugging.
This function has been introduced as an alternative way to enable
debugging. It is important to assure that only one thread accesses
GPGME functions between a call to this function and after the
return from the call to `gpgme_check_version'.
To enable debugging, you need to call this function as early as
possible -- even before `gpgme_check_version' -- with the string
"debug" for NAME and VALUE identical to the value used with the
environment variable `GPGME_DEBUG'.
This function returns `0' on success. In contrast to other
functions the non-zero return value on failure does not convey any
error code. For setting "debug" the only possible error cause is
an out of memory condition; which would exhibit itself later
anyway. Thus the return value may be ignored.
Thus your init code may look like this:
/* Initialize the locale environment. */
setlocale (LC_ALL, "");
gpgme_set_global_flag ("debug", "9:/tmp/gpgme.log");
gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL));
Does this make sense?
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
More information about the Gnupg-devel