summaryrefslogtreecommitdiff
path: root/src/core/execute.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/execute.c')
-rw-r--r--src/core/execute.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index 7b071e8c9e..1f6072c6ab 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1617,7 +1617,8 @@ static int exec_child(
return -errno;
}
- if (chdir(context->working_directory ? context->working_directory : "/") < 0) {
+ if (chdir(context->working_directory ?: "/") < 0 &&
+ !context->working_directory_missing_ok) {
*exit_status = EXIT_CHDIR;
return -errno;
}