summaryrefslogtreecommitdiff
path: root/xdpyinfo.c
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2008-05-21 14:18:57 -0400
committerAdam Jackson <ajax@redhat.com>2008-05-21 14:18:57 -0400
commitf70bd6335967fb3992399411d33e015b0d4d8f1d (patch)
treec6c238dddba8379fd51a0668b7e6fa8428f5c677 /xdpyinfo.c
parent2c094e502060be530a306fe7f8feed6eddf9266f (diff)
Ignore errors from xf86misc rather than crashing out.
Diffstat (limited to 'xdpyinfo.c')
-rw-r--r--xdpyinfo.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/xdpyinfo.c b/xdpyinfo.c
index 8241686..0a4ff63 100644
--- a/xdpyinfo.c
+++ b/xdpyinfo.c
@@ -135,6 +135,14 @@ in this Software without prior written authorization from The Open Group.
char *ProgramName;
Bool queryExtensions = False;
+static int
+silent_errors(Display *dpy, XErrorEvent *ev)
+{
+ return 0;
+}
+
+static int (*old_handler)(Display *, XErrorEvent *) = NULL;
+
static int print_event_mask(char *buf, int lastcol, int indent, long mask);
static int StrCmp(const void *a, const void *b)
@@ -730,12 +738,16 @@ print_dga_info(Display *dpy, char *extname)
return 1;
}
+ old_handler = XSetErrorHandler(silent_errors);
+
if (!XF86DGAGetVideoLL(dpy, DefaultScreen(dpy), &offset,
&width, &bank, &ram))
return 0;
printf(" Base address = 0x%X, Width = %d, Bank size = %d,"
" RAM size = %dk\n", offset, width, bank, ram);
+ XSetErrorHandler(old_handler);
+
return 1;
}
#endif
@@ -856,6 +868,8 @@ print_XF86Misc_info(Display *dpy, char *extname)
return 0;
print_standard_extension_info(dpy, extname, majorrev, minorrev);
+ old_handler = XSetErrorHandler(silent_errors);
+
if ((majorrev > 0) || (majorrev == 0 && minorrev > 0)) {
if (!XF86MiscGetKbdSettings(dpy, &kbdinfo))
return 0;
@@ -887,6 +901,8 @@ print_XF86Misc_info(Display *dpy, char *extname)
printf(" Buttons: %d\n", mouseinfo.buttons);
}
+ XSetErrorHandler(old_handler);
+
return 1;
}
#endif