summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-03-19 16:55:43 +0100
committerLennart Poettering <lennart@poettering.net>2014-03-19 19:09:00 +0100
commitb46a529c7c2d8e1db000ff00ddf42fc9f86d54e1 (patch)
tree49234562297442a74bc1c3df5b90a19877775110 /src/core
parentd99a70529637d44cdd8f6ade3b981ea33f09d90d (diff)
core: when PrivateTmp= is set for a unit, make sure to order it after /tmp and /var/tmp are mounted
Diffstat (limited to 'src/core')
-rw-r--r--src/core/unit.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 20b139d31b..4c1754f37f 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -686,6 +686,19 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
return r;
}
+ if (u->manager->running_as != SYSTEMD_SYSTEM)
+ return 0;
+
+ if (c->private_tmp) {
+ r = unit_require_mounts_for(u, "/tmp");
+ if (r < 0)
+ return r;
+
+ r = unit_require_mounts_for(u, "/var/tmp");
+ if (r < 0)
+ return r;
+ }
+
if (c->std_output != EXEC_OUTPUT_KMSG &&
c->std_output != EXEC_OUTPUT_SYSLOG &&
c->std_output != EXEC_OUTPUT_JOURNAL &&
@@ -703,11 +716,9 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
/* If syslog or kernel logging is requested, make sure our own
* logging daemon is run first. */
- if (u->manager->running_as == SYSTEMD_SYSTEM) {
- r = unit_add_dependency_by_name(u, UNIT_AFTER, SPECIAL_JOURNALD_SOCKET, NULL, true);
- if (r < 0)
- return r;
- }
+ r = unit_add_dependency_by_name(u, UNIT_AFTER, SPECIAL_JOURNALD_SOCKET, NULL, true);
+ if (r < 0)
+ return r;
return 0;
}