[PATCH xserver] Fix error handling in doLoadModule()

Knut Petersen Knut_Petersen at t-online.de
Thu Sep 29 00:17:27 PDT 2011


dlopen() as well as LoaderOpen() return NULL in case of an error,
but the old code checked for a negative return value to detect a
failure. Because of that it tried to continue and failed later,
erroneously reporting  that there is no xyzModuleData data object
in module xyz.

This commit fixes the problem described above and adds an error
message.

Partially fixes: https://bugs.freedesktop.org/show_bug.cgi?id=41208

Signed-off-by: Knut Petersen <Knut_Petersen at t-online.de>
---
 hw/xfree86/loader/loadmod.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 9f82099..4c0d721 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -917,9 +917,19 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
 	    *errmin = 0;
 	goto LoadModule_fail;
     }
-    ret->handle = LoaderOpen(found, errmaj, errmin);
-    if (ret->handle < 0)
+    /*
+     * 
+     */
+    if (!(ret->handle = LoaderOpen(found, errmaj, errmin))) {
+	xf86Msg(X_WARNING, "Warning, loading of module %s failed.\n"
+	    "If the message above complains about an unresolved symbol,\n"
+	    "you might be able to fix the problem by adding the module\n"
+	    "that defines that symbol to a 'Section\"Module\"' in your\n"
+	    "configuration.\n"
+	    "Please report the problem to bugs.freedesktop.org\n",
+	    module);
 	goto LoadModule_fail;
+    }
     ret->path = strdup(found);
 
     /* drop any explicit suffix from the module name */
-- 
1.7.6.3


--------------010101060501030704010306--


More information about the xorg-devel mailing list