summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2022-07-14 07:26:40 +0600
committerHiltjo Posthuma <hiltjo@codemadness.org>2022-07-15 20:53:58 +0200
commit6613d9f9a1a5630bab30bc2b70bdc793977073ee (patch)
tree914cd55c1688ed675fab188ac562b17904471da1 /dwm.c
parentuse named parameter for func prototype (diff)
downloaddwm-6613d9f9a1a5630bab30bc2b70bdc793977073ee.tar.gz
dwm-6613d9f9a1a5630bab30bc2b70bdc793977073ee.zip
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`.
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dwm.c b/dwm.c
index b3c43ee..7c0f978 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1541,6 +1541,8 @@ setup(void)
1541 Atom utf8string; 1541 Atom utf8string;
1542 1542
1543 /* clean up any zombies immediately */ 1543 /* clean up any zombies immediately */
1544 if (signal(SIGCHLD, sigchld) == SIG_ERR)
1545 die("can't install SIGCHLD handler:");
1544 sigchld(0); 1546 sigchld(0);
1545 1547
1546 /* init screen */ 1548 /* init screen */
@@ -1638,8 +1640,6 @@ showhide(Client *c)
1638void 1640void
1639sigchld(int unused) 1641sigchld(int unused)
1640{ 1642{
1641 if (signal(SIGCHLD, sigchld) == SIG_ERR)
1642 die("can't install SIGCHLD handler:");
1643 while (0 < waitpid(-1, NULL, WNOHANG)); 1643 while (0 < waitpid(-1, NULL, WNOHANG));
1644} 1644}
1645 1645