[PATCH] Fix segfault when -extension XKEYBOARD is passed on the command line
Alan Coopersmith
alan.coopersmith at sun.com
Fri Oct 16 22:34:20 PDT 2009
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 at sun.com>
---
This one should be a candidate for 1.7.1 as well, to reduce the number
of bug reports generated by core dumps.
mi/miinitext.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 0dca390..6897dd1 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 */
+ }
}
}
@@ -374,8 +380,11 @@ void EnableDisableExtensionError(char *name, Bool enable)
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
More information about the xorg-devel
mailing list