diff options
Diffstat (limited to 'src/basic/exec-util.c')
-rw-r--r-- | src/basic/exec-util.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/basic/exec-util.c b/src/basic/exec-util.c index 7896f9369..cfb082a03 100644 --- a/src/basic/exec-util.c +++ b/src/basic/exec-util.c @@ -71,11 +71,12 @@ static int do_execute( gather_stdout_callback_t const callbacks[_STDOUT_CONSUME_MAX], void* const callback_args[_STDOUT_CONSUME_MAX], int output_fd, - char *argv[]) { + char *argv[], + char *envp[]) { _cleanup_hashmap_free_free_ Hashmap *pids = NULL; _cleanup_strv_free_ char **paths = NULL; - char **path; + char **path, **e; int r; /* We fork this all off from a child process so that we can somewhat cleanly make @@ -100,6 +101,9 @@ static int do_execute( if (timeout != USEC_INFINITY) alarm(DIV_ROUND_UP(timeout, USEC_PER_SEC)); + STRV_FOREACH(e, envp) + putenv(*e); + STRV_FOREACH(path, paths) { _cleanup_free_ char *t = NULL; _cleanup_close_ int fd = -1; @@ -170,7 +174,8 @@ int execute_directories( usec_t timeout, gather_stdout_callback_t const callbacks[_STDOUT_CONSUME_MAX], void* const callback_args[_STDOUT_CONSUME_MAX], - char *argv[]) { + char *argv[], + char *envp[]) { char **dirs = (char**) directories; _cleanup_close_ int fd = -1; @@ -201,7 +206,7 @@ int execute_directories( if (r < 0) return r; if (r == 0) { - r = do_execute(dirs, timeout, callbacks, callback_args, fd, argv); + r = do_execute(dirs, timeout, callbacks, callback_args, fd, argv, envp); _exit(r < 0 ? EXIT_FAILURE : EXIT_SUCCESS); } |