1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-27 10:25:37 +03:00

exec: also evaluate working_directory_missing_ok when not applying chroots

This commit is contained in:
Lennart Poettering 2015-02-12 18:58:43 +01:00
parent 615aaf412c
commit cf1d0302ae

View File

@ -1626,13 +1626,14 @@ static int exec_child(
_cleanup_free_ char *d = NULL;
if (asprintf(&d, "%s/%s",
context->root_directory ? context->root_directory : "",
context->working_directory ? context->working_directory : "") < 0) {
context->root_directory ?: "",
context->working_directory ?: "") < 0) {
*exit_status = EXIT_MEMORY;
return -ENOMEM;
}
if (chdir(d) < 0) {
if (chdir(d) < 0 &&
!context->working_directory_missing_ok) {
*exit_status = EXIT_CHDIR;
return -errno;
}