From c6c133c637383b0a7606fe07b4fbc5d2f9b94228 Mon Sep 17 00:00:00 2001 From: Per Nilsson Date: Tue, 4 Jan 2022 19:00:51 +0100 Subject: [PATCH] Show errors for dlopen and dlsym --- common/ecdh.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/ecdh.c b/common/ecdh.c index f094b0a3..170d9174 100644 --- a/common/ecdh.c +++ b/common/ecdh.c @@ -1582,14 +1582,15 @@ int ecdh_load_module(const char *module, FILE *out) { if (strcmp(module, "-")) { module_handle = dlopen(module, RTLD_NOW | RTLD_GLOBAL); if (module_handle == 0) { - fprintf(out, "Can't open shared library '%s'\n", module); + fprintf(out, "Can't open shared library '%s': %s\n", module, dlerror()); return CKR_ARGUMENTS_BAD; } CK_C_GetFunctionList fn = 0; *(void **) (&fn) = dlsym(module_handle, "C_GetFunctionList"); if (fn == 0) { - fprintf(out, "Can't find symbol 'C_GetFunctionList' in '%s'\n", module); + fprintf(out, "Can't find symbol 'C_GetFunctionList' in '%s': %s\n", + module, dlerror()); dlclose(module_handle); module_handle = 0; return CKR_GENERAL_ERROR;