apply latest suckless commit

This commit is contained in:
speedie 2023-02-04 12:57:26 +01:00
parent fb4823bea1
commit b46b7e962f
2 changed files with 28 additions and 27 deletions

View file

@ -54,7 +54,11 @@ speedwm: ${OBJ}
ifdef USESTATUS
status: status.o
cp status.h status.def.h
[ -f "status.rl.h" ] && cp status.rl.h status.h || :
$(CC) status.o $(CFLAGS) $(LDFLAGS) -o speedwm_status
mv status.def.h status.h
chmod 0777 status.h
status.o: status.c status.h
$(CC) -c status.c
endif

View file

@ -639,7 +639,6 @@ static void hideall(const Arg *arg);
static void showwin(Client *c);
static void showhide(Client *c);
static void sigchld(int unused);
#ifdef XINERAMA
static void sortscreens(XineramaScreenInfo *screens, int n);
#endif
@ -5127,11 +5126,31 @@ setup(void)
{
XSetWindowAttributes wa;
Atom utf8string;
struct sigaction sa;
pid_t pid;
/* clean up any zombies immediately */
if (signal(SIGCHLD, sigchld) == SIG_ERR)
die("can't install SIGCHLD handler:");
sigchld(0);
/* do not transform children into zombies when they terminate */
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_NOCLDSTOP | SA_NOCLDWAIT | SA_RESTART;
sa.sa_handler = SIG_IGN;
sigaction(SIGCHLD, &sa, NULL);
/* clean up any zombies (inherited from .xinitrc etc) immediately */
while ((pid = waitpid(-1, NULL, WNOHANG) > 0)) {
pid_t *p, *lim;
if (!(p = autostart_pids))
continue;
lim = &p[autostart_len];
for (; p < lim; p++) {
if (*p == pid) {
*p = -1;
break;
}
}
}
signal(SIGHUP, sighup);
signal(SIGTERM, sigterm);
@ -5326,28 +5345,6 @@ reloadcolors(const Arg *arg)
}
#endif
void
sigchld(int unused)
{
pid_t pid;
while (0 < (pid = waitpid(-1, NULL, WNOHANG))) {
pid_t *p, *lim;
if (!(p = autostart_pids))
continue;
lim = &p[autostart_len];
for (; p < lim; p++) {
if (*p == pid) {
*p = -1;
break;
}
}
}
}
void
sighup(int unused)
{