summaryrefslogtreecommitdiffstats
path: root/runtime/modules.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-04-29 15:36:22 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-04-29 15:36:22 +0200
commit055d4ffc2afc77e03a3d31720d4a0998f8c3d92c (patch)
treebab872b075c24ba84f6658b5e339759af188591d /runtime/modules.c
parent1cce2e35b06b54469dd627454c0f58818ff3523a (diff)
downloadrsyslog-055d4ffc2afc77e03a3d31720d4a0998f8c3d92c.tar.gz
rsyslog-055d4ffc2afc77e03a3d31720d4a0998f8c3d92c.tar.xz
rsyslog-055d4ffc2afc77e03a3d31720d4a0998f8c3d92c.zip
fixed problem with module unload sequence
Diffstat (limited to 'runtime/modules.c')
-rw-r--r--runtime/modules.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/runtime/modules.c b/runtime/modules.c
index c156fef2..1e59a5fc 100644
--- a/runtime/modules.c
+++ b/runtime/modules.c
@@ -522,11 +522,16 @@ modUnloadAndDestructAll(eModLinkType_t modLinkTypesToUnload)
if(modLinkTypesToUnload == eMOD_LINK_ALL || pModCurr->eLinkType == modLinkTypesToUnload) {
if(modUnlinkAndDestroy(&pModCurr) == RS_RET_MODULE_STILL_REFERENCED) {
pModCurr = GetNxt(pModCurr);
+ } else {
+ /* Note: if the module was successfully unloaded, it has updated the
+ * pModCurr pointer to the next module. However, the unload process may
+ * still have indirectly referenced the pointer list in a way that the
+ * unloaded module is not aware of. So we restart the unload process
+ * to make sure we do not fall into a trap (what we did ;)). The
+ * performance toll is minimal. -- rgerhards, 2008-04-28
+ */
+ pModCurr = GetNxt(NULL);
}
- /* Note: if the module was successfully unloaded, it has updated the
- * pModCurr pointer to the next module. So we do NOT need to advance
- * to the next module on successful unload.
- */
} else {
pModCurr = GetNxt(pModCurr);
}