summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2010-09-01 07:58:18 +0200
committerThomas Hellstrom <thellstrom@vmware.com>2010-09-01 08:00:40 +0200
commit81a0a1a37e703296d109022bb76a1291e84064fd (patch)
tree585f189276579f28efd9c229b381ac4a9af17a5e
parent2a72ea7a1b1519451350e0741d145f513124a208 (diff)
vmware: Handle chain-loader failures gracefully.
If the vmwlegacy driver wasn't present when expected, that would leave the X server in a confused state. Thus report loading errors properly back to the X server. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
-rw-r--r--src/vmwaremodule.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/vmwaremodule.c b/src/vmwaremodule.c
index b6c3adf..caa7d68 100644
--- a/src/vmwaremodule.c
+++ b/src/vmwaremodule.c
@@ -152,7 +152,7 @@ err:
return FALSE;
}
-static void
+static Bool
vmware_chain_module(pointer opts)
{
int vmwlegacy_devices;
@@ -163,6 +163,7 @@ vmware_chain_module(pointer opts)
GDevPtr *gdevs;
GDevPtr gdev;
int i;
+ pointer ret;
vmware_devices = xf86MatchDevice(VMWARE_DRIVER_NAME, &gdevs);
vmwgfx_devices = xf86MatchDevice(VMWGFX_DRIVER_NAME, NULL);
@@ -189,8 +190,16 @@ vmware_chain_module(pointer opts)
xfree(gdevs);
- if (!matched)
- xf86LoadOneModule(driver_name, opts);
+ if (!matched) {
+ if (xf86LoadOneModule(driver_name, opts) == NULL) {
+ xf86DrvMsg(-1, X_ERROR, "%s: Unexpected failure while "
+ "loading the \"%s\" driver. Giving up.\n",
+ VMWARE_DRIVER_NAME, driver_name);
+ return FALSE;
+ }
+ }
+
+ return TRUE;
}
@@ -221,9 +230,13 @@ vmware_setup(pointer module, pointer opts, int *errmaj, int *errmin)
setupDone = 1;
/* Chain load the real driver */
- vmware_chain_module(opts);
-
- return (pointer) 1;
+ if (vmware_chain_module(opts))
+ return (pointer) 1;
+ else {
+ if (errmaj)
+ *errmaj = LDR_NOSUBENT;
+ return NULL;
+ }
} else {
if (errmaj)
*errmaj = LDR_ONCEONLY;