The attached patch fixes an obvious error in loadmod.c.

It fixes one of the problems described in bug 41208, but
the main problem described in that bug report still is not
solved - without a proper "Section Module" xorg will not
start here.

knut
>From d5c321aea41aca6520c21ed20320d5197661d5c4 Mon Sep 17 00:00:00 2001
From: Knut Petersen <[email protected]>
Date: Thu, 29 Sep 2011 09:17:27 +0200
Subject: [PATCH xserver] Fix error handling in doLoadModule()

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 <[email protected]>
---
 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

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to