From 2cff816768b35933da6e1a7360b37e660bc5f37b Mon Sep 17 00:00:00 2001 From: NRK Date: Thu, 14 Jul 2022 07:26:40 +0600 Subject: do not call signal-unsafe function inside sighanlder die() calls vprintf, fputc and exit; none of these are async-signal-safe, see `man 7 signal-safety`. --- dwm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dwm.c b/dwm.c index 3eab607..a41a37b 100644 --- a/dwm.c +++ b/dwm.c @@ -1726,6 +1726,8 @@ setup(void) Atom utf8string; /* clean up any zombies immediately */ + if (signal(SIGCHLD, sigchld) == SIG_ERR) + die("can't install SIGCHLD handler:"); sigchld(0); signal(SIGHUP, sighup); @@ -1830,8 +1832,6 @@ showhide(Client *c) void sigchld(int unused) { - if (signal(SIGCHLD, sigchld) == SIG_ERR) - die("can't install SIGCHLD handler:"); while (0 < waitpid(-1, NULL, WNOHANG)); } -- cgit v1.2.3