Skip to content

Commit

Permalink
[dlclose] add logging messages around unloading libraries
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Sep 14, 2017
1 parent 728e105 commit f13fb2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion libknet/compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ void compress_fini(
}
compress_modules_cmds[idx].libref--;

if (compress_modules_cmds[idx].libref == 0) {
if ((compress_modules_cmds[idx].libref == 0) &&
(compress_modules_cmds[idx].loaded == 1)) {
log_debug(knet_h, KNET_SUB_COMPRESS, "Unloading %s library", compress_modules_cmds[idx].model_name);
compress_modules_cmds[idx].unload_lib(knet_h);
compress_modules_cmds[idx].loaded = 0;
}
Expand Down
8 changes: 6 additions & 2 deletions libknet/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ int crypto_init(
free(knet_h->crypto_instance);
knet_h->crypto_instance = NULL;
}
if (crypto_modules_cmds[model].libref == 0) {
if ((crypto_modules_cmds[model].libref == 0) &&
(crypto_modules_cmds[model].loaded == 1)) {
log_debug(knet_h, KNET_SUB_CRYPTO, "Unloading %s library", crypto_modules_cmds[model].model_name);
crypto_modules_cmds[model].unload_lib(knet_h);
crypto_modules_cmds[model].loaded = 0;
}
Expand Down Expand Up @@ -185,7 +187,9 @@ void crypto_fini(
knet_h->crypto_instance = NULL;
crypto_modules_cmds[model].libref--;

if (crypto_modules_cmds[model].libref == 0) {
if ((crypto_modules_cmds[model].libref == 0) &&
(crypto_modules_cmds[model].loaded == 1)) {
log_debug(knet_h, KNET_SUB_CRYPTO, "Unloading %s library", crypto_modules_cmds[model].model_name);
crypto_modules_cmds[model].unload_lib(knet_h);
crypto_modules_cmds[model].loaded = 0;
}
Expand Down

0 comments on commit f13fb2f

Please sign in to comment.