diff options
author | cos <cos> | 2023-11-08 15:02:19 +0100 |
---|---|---|
committer | cos <cos> | 2024-06-08 09:16:00 +0200 |
commit | 54c1d45da12109a157f80868ab545f82a6f8118c (patch) | |
tree | 627bbbbe871ba6102faf5a2b9261e86de8d830d7 | |
parent | 9a96a1628b3e8689953f6f4db9d544c732af5916 (diff) | |
download | mcwm-54c1d45da12109a157f80868ab545f82a6f8118c.zip |
Fix unintentional exit on suspend
Suspending xorg on FreeBSD (and possibly other scenarios) results in a
recoverable INTR from select(). Only exit on signal after actually
having recieved a signal.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | mcwm.c | 10 |
2 files changed, 8 insertions, 4 deletions
@@ -1,4 +1,4 @@ -VERSION=20180725 +VERSION=20231108 DIST=mcwm-$(VERSION) SRC=mcwm.c list.c config.h events.h list.h hidden.c DISTFILES=LICENSE Makefile NEWS README TODO WISHLIST mcwm.man hidden.man scripts $(SRC) @@ -3594,6 +3594,7 @@ void events(void) int fd; /* Our X file descriptor */ fd_set in; /* For select */ int found; /* Ditto. */ + int err; /* Get the file descriptor so we can do select() on it. */ fd = xcb_get_file_descriptor(conn); @@ -3622,8 +3623,9 @@ void events(void) * Check if we have an unrecoverable connection error, * like a disconnected X server. */ - if (xcb_connection_has_error(conn)) + if ((err = xcb_connection_has_error(conn))) { + PDEBUG("xcb_connection_has_error() returned %d.\n", err); cleanup(0); exit(1); } @@ -3633,8 +3635,10 @@ void events(void) { if (EINTR == errno) { - /* We received a signal. Break out of loop. */ - break; + if (sigcode != 0) { + /* We received a signal. Break out of loop. */ + break; + } } else { |