Skip to content

Commit

Permalink
Fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
iacore committed Jun 18, 2022
1 parent fe982cd commit 0201b61
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions gui-daemon/xside.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);


Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0201b61

Please sign in to comment.