From 2f977c646a0ff491b3814e7d3843259ec9c7c4e2 Mon Sep 17 00:00:00 2001 From: cos Date: Wed, 8 Nov 2023 15:02:19 +0100 Subject: 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. --- Makefile | 2 +- mcwm.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index ce0d71d..785dee4 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/mcwm.c b/mcwm.c index 4cd773f..482617c 100644 --- a/mcwm.c +++ b/mcwm.c @@ -3593,6 +3593,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); @@ -3621,8 +3622,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); } @@ -3632,8 +3634,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 { -- cgit v1.2.3