X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Fautomount.c;h=934aa5f35d78dc83716a56433d0ff3d4e8e28838;hb=73c33e7f225f81e6066386fba997e8ea2ba361b3;hp=b5003b3a756babf4a5f77979dd67662cbbf3ade2;hpb=4e67ddd6b39c2847cc399ab0874427baa7ea8935;p=elogind.git diff --git a/src/automount.c b/src/automount.c index b5003b3a7..934aa5f35 100644 --- a/src/automount.c +++ b/src/automount.c @@ -154,6 +154,11 @@ static int automount_verify(Automount *a) { if (a->meta.load_state != UNIT_LOADED) return 0; + if (path_equal(a->where, "/")) { + log_error("Cannot have an automount unit for the root directory. Refusing."); + return -EINVAL; + } + if (!(e = unit_name_from_path(a->where, ".automount"))) return -ENOMEM; @@ -196,7 +201,8 @@ static int automount_load(Unit *u) { if ((r = unit_add_dependency(u, UNIT_BEFORE, UNIT(a->mount), true)) < 0) return r; - if (a->meta.default_dependencies) + if (a->meta.default_dependencies && + a->meta.manager->running_as == MANAGER_SYSTEM) if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0) return r; }