]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/unit: don't set missing_ok if WorkingDirectory=~ is explicitly requested
authorMike Yuan <me@yhndnzj.com>
Sat, 25 May 2024 17:43:02 +0000 (01:43 +0800)
committerMike Yuan <me@yhndnzj.com>
Sun, 26 May 2024 05:40:49 +0000 (13:40 +0800)
src/core/unit.c

index 324f82c3a42baab9c1a7572e23e239106226d8cb..7698f601c742b05e5e4fbdb38a7c31cb204d85f2 100644 (file)
@@ -4238,16 +4238,14 @@ int unit_patch_contexts(Unit *u) {
                                         return -ENOMEM;
                         }
 
-                if (MANAGER_IS_USER(u->manager) &&
-                    !ec->working_directory) {
-
+                if (MANAGER_IS_USER(u->manager) && !ec->working_directory) {
                         r = get_home_dir(&ec->working_directory);
                         if (r < 0)
                                 return r;
 
-                        /* Allow user services to run, even if the
-                         * home directory is missing */
-                        ec->working_directory_missing_ok = true;
+                        if (!ec->working_directory_home)
+                                /* If home directory is implied by us, allow it to be missing. */
+                                ec->working_directory_missing_ok = true;
                 }
 
                 if (ec->private_devices)