chiark / gitweb /
core: don't fail to run services in --user instances if $HOME is missing
[elogind.git] / src / core / execute.c
index 874cdc7efee2730e12c09063920cc54b10c3ec3c..1f6072c6aba368f886ec24b604e90c5f3de6e4d5 100644 (file)
@@ -40,8 +40,6 @@
 #include <sys/poll.h>
 #include <glob.h>
 #include <sys/personality.h>
-#include <libgen.h>
-#undef basename
 
 #ifdef HAVE_PAM
 #include <security/pam_appl.h>
@@ -1619,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;
                 }