summaryrefslogtreecommitdiff
path: root/src/core/path.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/path.c')
-rw-r--r--src/core/path.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/core/path.c b/src/core/path.c
index 610901275c..460c1d3bf2 100644
--- a/src/core/path.c
+++ b/src/core/path.c
@@ -464,6 +464,7 @@ static void path_enter_dead(Path *p, PathResult f) {
static void path_enter_running(Path *p) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
+ Unit *trigger;
int r;
assert(p);
@@ -472,7 +473,14 @@ static void path_enter_running(Path *p) {
if (unit_stop_pending(UNIT(p)))
return;
- r = manager_add_job(UNIT(p)->manager, JOB_START, UNIT_TRIGGER(UNIT(p)), JOB_REPLACE, &error, NULL);
+ trigger = UNIT_TRIGGER(UNIT(p));
+ if (!trigger) {
+ log_unit_error(UNIT(p), "Unit to trigger vanished.");
+ path_enter_dead(p, TIMER_FAILURE_RESOURCES);
+ return;
+ }
+
+ r = manager_add_job(UNIT(p)->manager, JOB_START, trigger, JOB_REPLACE, &error, NULL);
if (r < 0)
goto fail;
@@ -553,12 +561,16 @@ static void path_mkdir(Path *p) {
static int path_start(Unit *u) {
Path *p = PATH(u);
+ Unit *trigger;
assert(p);
assert(p->state == PATH_DEAD || p->state == PATH_FAILED);
- if (UNIT_TRIGGER(u)->load_state != UNIT_LOADED)
+ trigger = UNIT_TRIGGER(u);
+ if (!trigger || trigger->load_state != UNIT_LOADED) {
+ log_unit_error(u, "Refusing to start, unit to trigger not loaded.");
return -ENOENT;
+ }
path_mkdir(p);