[dovecot-cvs] dovecot/src/lib module-dir.c,1.19,1.20

cras at dovecot.org cras at dovecot.org
Fri Jun 16 13:16:06 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv6117

Modified Files:
	module-dir.c 
Log Message:
Handle errors more correctly. Fixes problems with some OSes.



Index: module-dir.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/module-dir.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- module-dir.c	5 May 2006 14:21:22 -0000	1.19
+++ module-dir.c	16 Jun 2006 10:15:56 -0000	1.20
@@ -24,14 +24,18 @@
 	const char *error;
 	void *ret;
 
+	/* clear out old errors */
+	(void)dlerror();
+
 	/* get our init func */
 	ret = dlsym(module->handle, symbol);
-
-	error = dlerror();
-	if (error != NULL) {
-		i_error("module %s: dlsym(%s) failed: %s",
-			module->path, symbol, error);
-		ret = NULL;
+	if (ret == NULL) {
+		error = dlerror();
+		if (error != NULL) {
+			i_error("module %s: dlsym(%s) failed: %s",
+				module->path, symbol, error);
+			ret = NULL;
+		}
 	}
 
 	return ret;



More information about the dovecot-cvs mailing list