Skip to content

Commit

Permalink
Show errors for dlopen and dlsym
Browse files Browse the repository at this point in the history
  • Loading branch information
qpernil committed Jan 4, 2022
1 parent 7366bfe commit c6c133c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions common/ecdh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c6c133c

Please sign in to comment.