Mailing List Archive

segfault in GCRYCTL_SET_THREAD_CBS
The attached simple program tries to initialize gcrypt with pthread
support. On my debian system (testing/unstable, libgcrypt11 1.4.4-4)
this triggers a segfault during the call to
gcry_control(GCRYCTL_SET_THREAD_CBS).

What am i doing wrong? What have i missed?

--dkg
Re: segfault in GCRYCTL_SET_THREAD_CBS [ In reply to ]
On Tue, 27 Oct 2009 23:50, dkg@fifthhorseman.net said:

- ret = gcry_control(GCRYCTL_SET_THREAD_CBS, gcry_threads_pthread);
+ ret = gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);

This is the usual problem with general purpose ioctl-alike fucntions:
You don't have any type checking. I added examples to the docs.

Salam-Shalom,

Werner

--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: segfault in GCRYCTL_SET_THREAD_CBS [ In reply to ]
On 10/28/2009 09:54 AM, Werner Koch wrote:
> On Tue, 27 Oct 2009 23:50, dkg@fifthhorseman.net said:
>
> - ret = gcry_control(GCRYCTL_SET_THREAD_CBS, gcry_threads_pthread);
> + ret = gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
>
> This is the usual problem with general purpose ioctl-alike fucntions:
> You don't have any type checking. I added examples to the docs.

Thanks, Werner. That does fix it for me, and it seems obvious in
retrospect ;) I suspect having the examples in the docs will be useful.

Regards,

--dkg