diff options
author | Yann Droneaud <ydroneaud@mandriva.com> | 2009-03-26 12:05:30 +0100 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2009-04-14 10:22:01 -0400 |
commit | a78f73b0d01374089ca7fcd838b647f6cfd1663a (patch) | |
tree | 8f984547d4753994e8481c1b31a5b755b0e2444f | |
parent | Ansification and compile warning fixes. (diff) | |
download | xcman-a78f73b0d01374089ca7fcd838b647f6cfd1663a.tar.gz xcman-a78f73b0d01374089ca7fcd838b647f6cfd1663a.tar.bz2 xcman-a78f73b0d01374089ca7fcd838b647f6cfd1663a.tar.xz |
Fix error reporting
Use the 'name' looked up for extension errors
If 'name' is NULL, use XGetErrorText().
Report error on stderr.
Diffstat (limited to '')
-rw-r--r-- | xcompmgr.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -1742,6 +1742,7 @@ error (Display *dpy, XErrorEvent *ev) { int o; const char *name = NULL; + static char buffer[256]; if (should_ignore (dpy, ev->serial)) return 0; @@ -1772,9 +1773,17 @@ error (Display *dpy, XErrorEvent *ev) case BadGlyph: name ="BadGlyph"; break; default: break; } - - printf ("error %d request %d minor %d serial %lu\n", - ev->error_code, ev->request_code, ev->minor_code, ev->serial); + + if (name == NULL) + { + buffer[0] = '\0'; + XGetErrorText (dpy, ev->error_code, buffer, sizeof (buffer)); + name = buffer; + } + + fprintf (stderr, "error %d: %s request %d minor %d serial %lu\n", + ev->error_code, (strlen (name) > 0) ? name : "unknown", + ev->request_code, ev->minor_code, ev->serial); /* abort (); this is just annoying to most people */ return 0; |