Revert "remove sigchld function"

This reverts commit 1fa72b0772.
Fixes #97.
This commit is contained in:
Devin J. Pohly 2021-03-13 10:42:33 -06:00
parent 1fa72b0772
commit 43b6e804cf

20
dwl.c
View File

@ -278,6 +278,7 @@ static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg); static void setmfact(const Arg *arg);
static void setmon(Client *c, Monitor *m, unsigned int newtags); static void setmon(Client *c, Monitor *m, unsigned int newtags);
static void setup(void); static void setup(void);
static void sigchld(int unused);
static void spawn(const Arg *arg); static void spawn(const Arg *arg);
static void tag(const Arg *arg); static void tag(const Arg *arg);
static void tagmon(const Arg *arg); static void tagmon(const Arg *arg);
@ -1983,9 +1984,8 @@ setup(void)
* clients from the Unix socket, manging Wayland globals, and so on. */ * clients from the Unix socket, manging Wayland globals, and so on. */
dpy = wl_display_create(); dpy = wl_display_create();
/* Indicate explicitly to the OS that we are not interested in info /* clean up child processes immediately */
* about child processes (per POSIX.1-2001) */ sigchld(0);
signal(SIGCHLD, SIG_IGN);
/* The backend is a wlroots feature which abstracts the underlying input and /* The backend is a wlroots feature which abstracts the underlying input and
* output hardware. The autocreate option will choose the most suitable * output hardware. The autocreate option will choose the most suitable
@ -2136,6 +2136,20 @@ setup(void)
#endif #endif
} }
void
sigchld(int unused)
{
/* We should be able to remove this function in favor of a simple
* signal(SIGCHLD, SIG_IGN);
* but the Xwayland implementation in wlroots currently prevents us from
* setting our own disposition for SIGCHLD.
*/
if (signal(SIGCHLD, sigchld) == SIG_ERR)
EBARF("can't install SIGCHLD handler");
while (0 < waitpid(-1, NULL, WNOHANG))
;
}
void void
spawn(const Arg *arg) spawn(const Arg *arg)
{ {