Re: [dev] [PATCH] dwm -- Proper SIGCHLD usage , fix issue with uncollected processes

From: Neale Pickett <neale_AT_woozle.org>
Date: Thu, 13 Aug 2009 06:35:56 -0600

Anselm R Garbe <garbeam_AT_gmail.com> writes:

>
> I'm fine with this patch, will be applied soon.

We think you should also consider changing line 1431 to call sigchld(0)
instead of signal(SIGCHLD, sigchld). I haven't tested this yet, though.

Neale

>> ---
>>  dwm.c |    8 +++++---
>>  1 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/dwm.c b/dwm.c
>> index 873b794..3cb4a8e 100644
>> --- a/dwm.c
>> +++ b/dwm.c
>> @@ -207,7 +207,7 @@ static void setlayout(const Arg *arg);
>>  static void setmfact(const Arg *arg);
>>  static void setup(void);
>>  static void showhide(Client *c);
>> -static void sigchld(int signal);
>> +static void sigchld(int unused);
>>  static void spawn(const Arg *arg);
>>  static void tag(const Arg *arg);
>>  static void tagmon(const Arg *arg);
>> @@ -1428,6 +1428,8 @@ setup(void) {
>>        int w;
>>        XSetWindowAttributes wa;
>>
>> +       signal(SIGCHLD, sigchld);
>> +
>>        /* init screen */
>>        screen = DefaultScreen(dpy);
>>        root = RootWindow(dpy, screen);
>> @@ -1496,13 +1498,13 @@ showhide(Client *c) {
>>
>>
>>  void
>> -sigchld(int signal) {
>> +sigchld(int unusedl) {
>>        while(0 < waitpid(-1, NULL, WNOHANG));
>> +       signal(SIGCHLD, sigchld);
>>  }
>>
>>  void
>>  spawn(const Arg *arg) {
>> -       signal(SIGCHLD, sigchld);
>>        if(fork() == 0) {
>>                if(dpy)
>>                        close(ConnectionNumber(dpy));
Received on Thu Aug 13 2009 - 12:35:56 UTC

This archive was generated by hypermail 2.2.0 : Sun Aug 16 2009 - 14:18:46 UTC