wendy

inotify based node watcher
git clone git://git.2f30.org/wendy
Log | Files | Refs | README | LICENSE

commit 1cfef0a6de2446814e1947e5bc0e73ab744f2d6d
parent d8f37c773ffd11256084aec460d136491310bbbe
Author: z3bra <willyatmailoodotorg>
Date:   Fri, 29 Apr 2016 20:14:25 +0200

Replace execvpe() call with execvp()

The `execvpe()` implementation I had was hacky, inadequate and
disrespectful regarding the `const` attributes specified in `unistd.h`.
Moreover, `execvpe()` require _GNU_SOURCE to be set for no particular
advantage in our case.

Diffstat:
Mwendy.c | 15+--------------
1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/wendy.c b/wendy.c @@ -33,8 +33,6 @@ struct node_t { struct node_t *next; }; -extern char **environ; - int verbose = 0, nb = 0; struct node_t *head = NULL; @@ -101,17 +99,6 @@ read_filename(int fd) return NULL; } -int -execvpe(const char *program, char **argv, char **envp) -{ - char **saved = environ; - int rc; - environ = envp; - rc = execvp(program, argv); - environ = saved; - return rc; -} - struct node_t * add_node(int wd, const char *path) { @@ -262,7 +249,7 @@ main (int argc, char **argv) setenv(ENV_MASK, strmask, 1); setenv(ENV_PATH, EVENT_PATH(ev), 1); if (!fork()) - if (!fork()) execvpe(cmd[0], cmd, environ); + if (!fork()) execvp(cmd[0], cmd); else exit(0); else wait(NULL); }