From 0201b6151c5ac60aa255c6fe6313737d544d5155 Mon Sep 17 00:00:00 2001 From: Locria Cyber <74560659+locriacyber@users.noreply.github.com> Date: Sat, 18 Jun 2022 23:48:36 +0200 Subject: [PATCH] Fix error handling --- gui-daemon/xside.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gui-daemon/xside.c b/gui-daemon/xside.c index 11fda3e4..7f1e42c9 100644 --- a/gui-daemon/xside.c +++ b/gui-daemon/xside.c @@ -277,7 +277,8 @@ int x11_error_handler(Display * dpy, XErrorEvent * ev) char error_msg[1024]; XGetErrorText(ev->display, ev->error_code, error_msg, sizeof(error_msg)); - fprintf(stderr, "Encountered X Error:\n"); + int now = (int) time(NULL); // truncate + fprintf(stderr, "[%d] Encountered X Error:\n", now); fprintf(stderr, error_msg); @@ -402,7 +403,7 @@ static Window mkwindow(Ghandles * g, struct windowdata *vm_window) XISetMask(xi_mask.mask, XI_FocusOut); int err = XISelectEvents(g->display, child_win, &xi_mask, 1); - if (!err) { + if (err) { fprintf(stderr, "Failed to subscribe to XI events. ErrCode: %d\n", err); exit(1); } @@ -1941,9 +1942,9 @@ static void send_keymap_notify(Ghandles * g) struct msg_hdr hdr; char keys[32]; int err = XQueryKeymap(g->display, keys); - if (!err) { + if (err) { fprintf(stderr, "XQueryKeymap failed: %d.\n", err); - exit(1); + return; // non fatal } hdr.type = MSG_KEYMAP_NOTIFY; hdr.window = 0;