wendy

wendy for debian packaging
git clone git://git.unixkoans.com/wendy.git
Log | Files | Refs | README | LICENSE

commit 914fb4ad0fa9e4e14541ccd0baf749c582e6227a
parent d23d7988ed57234856fc6c8633582bf147a743e0
Author: z3bra <willy@mailoo.org>
Date:   Mon Jun 15 00:12:09 +0200

added double forking to avoid zombie children

Diffstat:
wendy.c | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/wendy.c b/wendy.c @@ -21,6 +21,7 @@ #include <linux/limits.h> #include <string.h> #include <sys/inotify.h> +#include <sys/wait.h> /* definitions, defaults, bla bla blah */ #define EVENT_SIZE (sizeof(struct inotify_event)) @@ -252,8 +253,14 @@ main (int argc, char **argv) * Me neither. Just trust the if(). */ if (cmd) { - /* OMG a new event ! Quick, raise an alert ! */ - if (!fork()) { execvpe(cmd[0], cmd, environ); } + /* + * OMG a new event! raise an alert! + * Also, double-forking. + */ + if (!fork()) + if (!fork()) execvpe(cmd[0], cmd, environ); + else exit(0); + else wait(NULL); } /* jump to the next one */