summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-10-16 22:29:26 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2009-10-19 11:20:16 +1000
commit650ac84a0cf62c139fa6254fb7a44157d551e8e3 (patch)
tree92caf420efd2b56e2227e905000f3b072dbe5b50 /mi
parenta8bfbd81b8aaac31b87d15257273d82174912b37 (diff)
Fix segfault when -extension XKEYBOARD is passed on the command line
Users should be told they can't disable XKB or XInput via error messages, not core dumps. Reported by T`2 on #xorg irc Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Signed-off-by: Keith Packard <keithp@keithp.com> (cherry picked from commit 2bd71a6db241924bd17ac9dd4aa38e7e563ee5c1)
Diffstat (limited to 'mi')
-rw-r--r--mi/miinitext.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 0dca390bb..2a67fd371 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -359,8 +359,14 @@ Bool EnableDisableExtension(char *name, Bool enable)
for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
if (strcmp(name, ext->name) == 0) {
- *ext->disablePtr = !enable;
- return TRUE;
+ if (ext->disablePtr != NULL) {
+ *ext->disablePtr = !enable;
+ return TRUE;
+ } else {
+ /* Extension is always on, impossible to disable */
+ return enable; /* okay if they wanted to enable,
+ fail if they tried to disable */
+ }
}
}
@@ -370,12 +376,24 @@ Bool EnableDisableExtension(char *name, Bool enable)
void EnableDisableExtensionError(char *name, Bool enable)
{
ExtensionToggle *ext = &ExtensionToggleList[0];
+ Bool found = FALSE;
- ErrorF("[mi] Extension \"%s\" is not recognized\n", name);
+ for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
+ if ((strcmp(name, ext->name) == 0) && (ext->disablePtr == NULL)) {
+ ErrorF("[mi] Extension \"%s\" can not be disabled\n", name);
+ found = TRUE;
+ break;
+ }
+ }
+ if (found == FALSE)
+ ErrorF("[mi] Extension \"%s\" is not recognized\n", name);
ErrorF("[mi] Only the following extensions can be run-time %s:\n",
enable ? "enabled" : "disabled");
- for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++)
- ErrorF("[mi] %s\n", ext->name);
+ for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
+ if (ext->disablePtr != NULL) {
+ ErrorF("[mi] %s\n", ext->name);
+ }
+ }
}
#ifndef XFree86LOADER