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

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-serv19159

Modified Files:
      Tag: branch_1_0
	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.19.2.1
diff -u -d -r1.19 -r1.19.2.1
--- module-dir.c	5 May 2006 14:21:22 -0000	1.19
+++ module-dir.c	16 Jun 2006 10:15:55 -0000	1.19.2.1
@@ -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