be less verbose on non-errors

Nikos Mavrogiannopoulos nmav at redhat.com
Mon Jun 30 05:36:43 PDT 2014


On Mon, 2014-06-30 at 13:52 +0200, Stef Walter wrote:
> On 27.06.2014 17:26, Nikos Mavrogiannopoulos wrote:
> > This patch makes p11-kit a bit less verbose.
> 
> -		if (rv != CKR_OK) {
> +		if (rv != CKR_OK && rv != CKR_CRYPTOKI_ALREADY_INITIALIZED) {
> Thanks for the patch, but wouldn't this cause problems when
> p11_kit_modules_finalize() (or another C_Finalize invocation) is called,
> and the module would be finalized too many times?
> Where did you see this happen? Was the module loaded with the
> P11_KIT_UNMANAGED flag? The goal is that when modules are managed by
> p11-kit they never return that error code.

I'm seeing this error code when I reinitialize after a fork and use
soft-tokens like softhsm under p11-kit.  Run for example the attached
test (has to be compiled as a p11-kit test) and you'll see:
p11-kit: (unknown): module failed to initialize: The module has already
been initialized

Also printing in stderr when not being instructed to is quite dangerous
for a library. In that particular case that error was going out to
apache log. Maybe all errors should be silenced unless the P11_KIT env
variable is set or so.

regards,
Nikos

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-soft.c
Type: text/x-csrc
Size: 2838 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/p11-glue/attachments/20140630/4be59a09/attachment.c>


More information about the p11-glue mailing list