X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fpath.c;h=30d946d788a66cb58bbd4b971c10f456fa78c0f4;hb=a40eb73224e237f758d38847ae216c019425ebac;hp=16ea08ddedca3445a3768587180310fe442905d3;hpb=6124958c7bda3fed9b079e8217781480797703f5;p=elogind.git diff --git a/src/path.c b/src/path.c index 16ea08dde..30d946d78 100644 --- a/src/path.c +++ b/src/path.c @@ -29,12 +29,13 @@ #include "unit-name.h" #include "path.h" #include "dbus-path.h" +#include "special.h" static const UnitActiveState state_translation_table[_PATH_STATE_MAX] = { [PATH_DEAD] = UNIT_INACTIVE, [PATH_WAITING] = UNIT_ACTIVE, [PATH_RUNNING] = UNIT_ACTIVE, - [PATH_MAINTENANCE] = UNIT_INACTIVE_MAINTENANCE + [PATH_MAINTENANCE] = UNIT_MAINTENANCE }; static void path_done(Unit *u) { @@ -65,10 +66,7 @@ int path_add_one_mount_link(Path *p, Mount *m) { if (!path_startswith(s->path, m->where)) continue; - if ((r = unit_add_dependency(UNIT(m), UNIT_BEFORE, UNIT(p), true)) < 0) - return r; - - if ((r = unit_add_dependency(UNIT(p), UNIT_REQUIRES, UNIT(m), true)) < 0) + if ((r = unit_add_two_dependencies(UNIT(p), UNIT_AFTER, UNIT_REQUIRES, UNIT(m), true)) < 0) return r; } @@ -123,6 +121,11 @@ static int path_load(Unit *u) { if ((r = path_add_mount_links(p)) < 0) return r; + + /* Path units shouldn't stay around on shutdown */ + if (p->meta.default_dependencies) + if ((r = unit_add_two_dependencies_by_name(u, UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true)) < 0) + return r; } return path_verify(p);