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`.
This commit is contained in:
		
							
								
								
									
										4
									
								
								dwm.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								dwm.c
									
									
									
									
									
								
							@@ -1541,6 +1541,8 @@ setup(void)
 | 
				
			|||||||
	Atom utf8string;
 | 
						Atom utf8string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* clean up any zombies immediately */
 | 
						/* clean up any zombies immediately */
 | 
				
			||||||
 | 
						if (signal(SIGCHLD, sigchld) == SIG_ERR)
 | 
				
			||||||
 | 
							die("can't install SIGCHLD handler:");
 | 
				
			||||||
	sigchld(0);
 | 
						sigchld(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* init screen */
 | 
						/* init screen */
 | 
				
			||||||
@@ -1638,8 +1640,6 @@ showhide(Client *c)
 | 
				
			|||||||
void
 | 
					void
 | 
				
			||||||
sigchld(int unused)
 | 
					sigchld(int unused)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (signal(SIGCHLD, sigchld) == SIG_ERR)
 | 
					 | 
				
			||||||
		die("can't install SIGCHLD handler:");
 | 
					 | 
				
			||||||
	while (0 < waitpid(-1, NULL, WNOHANG));
 | 
						while (0 < waitpid(-1, NULL, WNOHANG));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user