Keith Packard wrote:
> Excerpts from Alan Coopersmith's message of Sat Oct 17 14:34:20 +0900 2009:
>> Users should be told they can't disable XKB or XInput via error messages,
>> not core dumps.
>
> It's weird that this makes the X server report:
>
> [mi] Extension "XKEYBOARD" is not recognized
>
> which seems like a lie to me.
Yeah, I was trying not to overcomplicate it. The attached changes it
to instead say:
[mi] Extension "XKEYBOARD" can not be disabled
--
-Alan Coopersmith- [email protected]
Sun Microsystems, Inc. - X Window System Engineering
>From 9f07d5a886a996ffc047b3b58a10b3c0faae85e2 Mon Sep 17 00:00:00 2001
From: Alan Coopersmith <[email protected]>
Date: Fri, 16 Oct 2009 22:29:26 -0700
Subject: [PATCH] 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 <[email protected]>
---
mi/miinitext.c | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 0dca390..2a67fd3 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
--
1.5.6.5
_______________________________________________
xorg-devel mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-devel