X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fautomount.c;h=3d85605fb4f46a7cd7f110b278716bd99deb31d0;hb=55293c152a0c8a8720461a26e2d6e24b5612d1f0;hp=32680461c24612d61ebe15c71a0d6a2169050d66;hpb=1b5601907efffd364b660bb75156b2aed49c46a4;p=elogind.git diff --git a/src/automount.c b/src/automount.c index 32680461c..3d85605fb 100644 --- a/src/automount.c +++ b/src/automount.c @@ -40,7 +40,7 @@ static const UnitActiveState state_translation_table[_AUTOMOUNT_STATE_MAX] = { [AUTOMOUNT_DEAD] = UNIT_INACTIVE, [AUTOMOUNT_WAITING] = UNIT_ACTIVE, [AUTOMOUNT_RUNNING] = UNIT_ACTIVE, - [AUTOMOUNT_MAINTAINANCE] = UNIT_INACTIVE, + [AUTOMOUNT_MAINTENANCE] = UNIT_INACTIVE, }; static int open_dev_autofs(Manager *m); @@ -264,7 +264,7 @@ static void automount_enter_dead(Automount *a, bool success) { if (!success) a->failure = true; - automount_set_state(a, a->failure ? AUTOMOUNT_MAINTAINANCE : AUTOMOUNT_DEAD); + automount_set_state(a, a->failure ? AUTOMOUNT_MAINTENANCE : AUTOMOUNT_DEAD); } static int open_dev_autofs(Manager *m) { @@ -562,12 +562,15 @@ static int automount_start(Unit *u) { assert(a); + assert(a->state == AUTOMOUNT_DEAD || a->state == AUTOMOUNT_MAINTENANCE); + if (path_is_mount_point(a->where)) { log_error("Path %s is already a mount point, refusing start for %s", a->where, u->meta.id); return -EEXIST; } - assert(a->state == AUTOMOUNT_DEAD || a->state == AUTOMOUNT_MAINTAINANCE); + if (a->mount->meta.load_state != UNIT_LOADED) + return -ENOENT; a->failure = false; automount_enter_waiting(a); @@ -751,7 +754,7 @@ static const char* const automount_state_table[_AUTOMOUNT_STATE_MAX] = { [AUTOMOUNT_DEAD] = "dead", [AUTOMOUNT_WAITING] = "waiting", [AUTOMOUNT_RUNNING] = "running", - [AUTOMOUNT_MAINTAINANCE] = "maintainance" + [AUTOMOUNT_MAINTENANCE] = "maintenance" }; DEFINE_STRING_TABLE_LOOKUP(automount_state, AutomountState);