dovecot-2.2: module_dir_unload(): Don't dlclose() modules if GDB...

dovecot at dovecot.org dovecot at dovecot.org
Tue Nov 6 23:53:17 EET 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/af331bc452d0
changeset: 15390:af331bc452d0
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Nov 06 23:53:11 2012 +0200
description:
module_dir_unload(): Don't dlclose() modules if GDB environment is set.

diffstat:

 src/lib/module-dir.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r 7d28b19fe28d -r af331bc452d0 src/lib/module-dir.c
--- a/src/lib/module-dir.c	Tue Nov 06 23:49:57 2012 +0200
+++ b/src/lib/module-dir.c	Tue Nov 06 23:53:11 2012 +0200
@@ -60,8 +60,13 @@
 {
 	if (module->deinit != NULL && module->initialized)
 		module->deinit();
-	if (dlclose(module->handle) != 0)
-		i_error("dlclose(%s) failed: %m", module->path);
+	/* dlclose()ing removes all symbols from valgrind's visibility.
+	   if GDB environment is set, don't actually unload the module
+	   (the GDB environment is used elsewhere too) */
+	if (getenv("GDB") == NULL) {
+		if (dlclose(module->handle) != 0)
+			i_error("dlclose(%s) failed: %m", module->path);
+	}
 	i_free(module->path);
 	i_free(module->name);
 	i_free(module);


More information about the dovecot-cvs mailing list