diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2016-02-11 13:29:53 +0100 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2016-02-11 13:29:53 +0100 |
commit | c8385ece1e3d7207b3898474925d53e9a656c9b5 (patch) | |
tree | 8d42544c8b724874b348c815f636c7132fa66fe2 /src/core/path.c | |
parent | cf92d86020fea4987040d1c4c1da5126a9d3cf7a (diff) | |
parent | e903182e5b0daa941de47a9c08c824106cec7fe0 (diff) |
Merge pull request #2576 from poettering/random-fixes
Random fixes
Diffstat (limited to 'src/core/path.c')
-rw-r--r-- | src/core/path.c | 16 |
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); |