diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index 3f06f564b3..e7d5e63c96 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -76,7 +76,13 @@ Units with PrivateTmp=disconnected automatically gain dependencies of type Wants= and After= on the mount required to access /var/, unless DefaultDependencies=no and/or - RootDirectory=/RootImage= are specified. + RootDirectory=/RootImage= are specified. If + DefaultDependencies=no is specified, and a + RequiresMountsFor=/var/, WantsMountsFor=/var/, + After=var.mount, RootDirectory=/RootImage= are + not specified, the private mount on /tmp/ is reused for + /var/tmp/ by setting $TMPDIR appropriately. + Units whose standard output or error output is connected to or (or their combinations with console output, see below) automatically acquire diff --git a/src/core/unit.c b/src/core/unit.c index dc158fb335..bb3430186c 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -4373,17 +4373,9 @@ static PrivateTmp unit_get_private_var_tmp(const Unit *u, const ExecContext *c) if (hashmap_contains(u->mounts_for[t], "/var/")) return PRIVATE_TMP_DISCONNECTED; - /* Check the same but for After= with Requires=/Requisite=/Wants= or friends. */ + /* Check the same but for After=. */ Unit *m = manager_get_unit(u->manager, "var.mount"); - if (!m) - return PRIVATE_TMP_NO; - - if (!unit_has_dependency(u, UNIT_ATOM_AFTER, m)) - return PRIVATE_TMP_NO; - - if (unit_has_dependency(u, UNIT_ATOM_PULL_IN_START, m) || - unit_has_dependency(u, UNIT_ATOM_PULL_IN_VERIFY, m) || - unit_has_dependency(u, UNIT_ATOM_PULL_IN_START_IGNORED, m)) + if (m && unit_has_dependency(u, UNIT_ATOM_AFTER, m)) return PRIVATE_TMP_DISCONNECTED; return PRIVATE_TMP_NO;