summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-01-27 01:23:20 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-01-27 01:23:41 -0500
commit36be24c8f82141fda995841d177e9e4113e1ef06 (patch)
treefcc525d5ad0f2d86f84842085d1f2bbf1bb86328 /src/core/unit.c
parent70b64bd3561c2bbe6cad2e590d4e3e25426f75b5 (diff)
core: require mounts for the root and working directories
We know that launching a unit will fail if some required directories haven't been mounted yet. There's no point in starting it just to have it fail even before it gets a chance to run.
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index fc1465834..e5ea994e5 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -671,6 +671,18 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
assert(u);
assert(c);
+ if (c->working_directory) {
+ r = unit_require_mounts_for(u, c->working_directory);
+ if (r < 0)
+ return r;
+ }
+
+ if (c->root_directory) {
+ r = unit_require_mounts_for(u, c->root_directory);
+ if (r < 0)
+ return r;
+ }
+
if (c->std_output != EXEC_OUTPUT_KMSG &&
c->std_output != EXEC_OUTPUT_SYSLOG &&
c->std_output != EXEC_OUTPUT_JOURNAL &&