diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-31 23:45:15 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-31 23:45:15 +0100 |
commit | 2edfa688d51080305a7c300bc10e4649bc5f484e (patch) | |
tree | d12a839c87aea5ff322feefb50a19d0ad8b31e6d /src/daemon.c | |
parent | m (diff) | |
download | sat-2edfa688d51080305a7c300bc10e4649bc5f484e.tar.gz sat-2edfa688d51080305a7c300bc10e4649bc5f484e.tar.bz2 sat-2edfa688d51080305a7c300bc10e4649bc5f484e.tar.xz |
preserve working directory
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to '')
-rw-r--r-- | src/daemon.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/daemon.c b/src/daemon.c index 12c1aea..e9c79d9 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -279,7 +279,7 @@ run_job_or_hook(struct job *job, const char *hook) t (!(args = restore_array(job->payload, job->n, &argsn))); t (!(argv = sublist(args, (size_t)(job->argc)))); - t (!(envp = sublist(args + job->argc, argsn - (size_t)(job->argc)))); + t (!(envp = sublist(args + job->argc, argsn - (size_t)(job->argc)))); /* Includes wdir. */ free(args), args = NULL; if (hook) { @@ -298,7 +298,8 @@ run_job_or_hook(struct job *job, const char *hook) close(STATE_FILENO); close(BOOT_FILENO); close(REAL_FILENO); - environ = envp; + (void)(status = chdir(envp[0])); + environ = envp + 1; execvp(*argv, argv); exit(1); default: |