gpgme_set_locale on global context fails ?

Leo Gaspard ekleog at gmail.com
Fri Jul 27 20:53:18 CEST 2012


Hello !

I'm learning GPGME, and just tried to use gpgme_set_locale. However, it looks 
like it doesn't work on the global context, only on a normal one.

Here is what I mean :
#include <gpgme.h>
#include <locale.h>
#include <stdio.h>

int main() {
    setlocale(LC_ALL, "");
    gpgme_ctx_t ctx;
    gpgme_new(&ctx);
    printf("%d\n", gpgme_set_locale(ctx, LC_ALL, setlocale(LC_ALL, NULL)));
    return 0;
}
It outputs 0, as expected.

Now, the issue :
#include <gpgme.h>
#include <locale.h>
#include <stdio.h>

int main() {
    setlocale(LC_ALL, "");
    printf("%d\n", gpgme_set_locale(NULL, LC_ALL, setlocale(LC_ALL, NULL)));
    return 0;
}
It outputs 117440567 ; that is "source: GPGME ; error: Invalid value".

Do you have any idea of what it may have come from ?

I have GPGME version 1.3.1, and GnuPG version 2.0.19, as distributed by archlinux.

Thanks in advance,

Ekleog



More information about the Gnupg-devel mailing list