From 21d7adf882f9f724af470daabf4819800dc59d4d Mon Sep 17 00:00:00 2001 From: Zedhugh Chen Date: Sun, 25 Jan 2026 11:25:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=8D=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E7=9A=84=E5=AD=90=E8=BF=9B=E7=A8=8B=E4=BF=A1=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib 会自动处理子进程资源,无需手动处理,手动处理不当反而会造成 bug --- src/wm.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/wm.c b/src/wm.c index 1a78b0d..41fd1c5 100644 --- a/src/wm.c +++ b/src/wm.c @@ -50,9 +50,6 @@ wm_t wm; /** argv used to run wm */ static char **cmd_argv; -/** A pipe that is used to asynchronously handle SIGCHLD */ -static int sigchld_pipe[2]; - static gboolean restart_on_signal(gpointer data) { wm_restart(); return TRUE; @@ -69,14 +66,6 @@ static void signal_fatal(int signal_number) { fatal("signal %d, dumping backtrace\n%s", signal_number, buffer.s); } -/* Signal handler for SIGCHLD. Causes reap_children() to be called. */ -static void signal_child(int signum) { - assert(signum == SIGCHLD); - int res = write(sigchld_pipe[1], " ", 1); - (void)res; - assert(res == 1); -} - static guint sources[3] = {0}; void wm_setup_signal(void) { @@ -92,10 +81,6 @@ void wm_setup_signal(void) { sigaction(SIGILL, &sa, 0); sigaction(SIGSEGV, &sa, 0); signal(SIGPIPE, SIG_IGN); - - sa.sa_handler = signal_child; - sa.sa_flags = SA_NOCLDSTOP | SA_RESTART; - sigaction(SIGCHLD, &sa, 0); } void wm_check_other_wm(void) {