commit 71bc1fa

wf  ·  2026-06-06 16:51:55 +0000 UTC
parent d94c8fa
Remove print from sig_handler

Apparently printf() is not very good in signal handlers because of reentrancy.
As a side effect, wm.running is now a sig_atomic_t.
2 files changed,  +3, -2
+3, -1
 1@@ -3,6 +3,7 @@
 2 
 3 #include <stdbool.h>
 4 #include <stdint.h>
 5+#include <signal.h>
 6 
 7 #include <wayland-server.h>
 8 #include <swc.h>
 9@@ -86,7 +87,8 @@ struct wm {
10 	struct grab   grab;
11 	uint8_t       ws;
12 	uint32_t      last_id;
13-	bool          running;
14+
15+	volatile sig_atomic_t running;
16 };
17 
18 #endif /* TYPES_H */
+0, -1
1@@ -214,7 +214,6 @@ setup_ipc(void) {
2 
3 static void
4 sig_handler(int s) {
5-	_wrn("caught deadly signal, exiting!");
6 	cleanup();
7 	if (wm.dpy) {
8 		swc_finalize();