summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2015-01-06 11:57:33 +0100
committerPeter Hutterer <peter.hutterer@who-t.net>2015-01-07 07:54:27 +1000
commit0c49f8f2bd56b1e77721e81030ea948386dcdf4e (patch)
tree833d4e5501eea142459c4ccbff2d7f525e0e0056
parent017b3736489985999d8dcf4d9e473e1fd6dd3647 (diff)
xwininfo: do not segfault on IO error
If the connection to the X server is lost while waiting for the user to select a window interactively, xwininfo segfaults. This is a regression introduced with the port to XCB, because xcb_wait_for_event() can return NULL in case of an IO error and xwininfo does not check for the actual returned value. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--dsimple.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/dsimple.c b/dsimple.c
index 6432e13..ca746e9 100644
--- a/dsimple.c
+++ b/dsimple.c
@@ -205,6 +205,8 @@ xcb_window_t Select_Window(xcb_connection_t *dpy,
xcb_allow_events (dpy, XCB_ALLOW_SYNC_POINTER, XCB_TIME_CURRENT_TIME);
xcb_flush (dpy);
event = xcb_wait_for_event (dpy);
+ if (event == NULL)
+ Fatal_Error ("Fatal IO error");
switch (event->response_type & 0x7f) {
case XCB_BUTTON_PRESS:
{