X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fmount.c;h=ed0f819c7ba71090449541b5f8cf904ce6eb6efe;hp=3411b734cc39ab3f86d7404f7acec6a70759e7b4;hb=133176702a03e5f6264f35c403dd7720d9e05c3f;hpb=81a5c6d03ef1e43e33bfb5ad006cf883c927a339 diff --git a/src/mount.c b/src/mount.c index 3411b734c..ed0f819c7 100644 --- a/src/mount.c +++ b/src/mount.c @@ -189,7 +189,7 @@ static int mount_add_mount_links(Mount *m) { if ((r = unit_add_dependency(UNIT(n), UNIT_REQUIRES, UNIT(m), true)) < 0) return r; - } else if (pm && path_startswith(pm->what, n->where)) { + } else if (pm && pm->what && path_startswith(pm->what, n->where)) { if ((r = unit_add_dependency(UNIT(m), UNIT_AFTER, UNIT(n), true)) < 0) return r; @@ -197,7 +197,7 @@ static int mount_add_mount_links(Mount *m) { if ((r = unit_add_dependency(UNIT(m), UNIT_REQUIRES, UNIT(n), true)) < 0) return r; - } else if (pn && path_startswith(pn->what, m->where)) { + } else if (pn && pn->what && path_startswith(pn->what, m->where)) { if ((r = unit_add_dependency(UNIT(n), UNIT_AFTER, UNIT(m), true)) < 0) return r; @@ -271,7 +271,7 @@ static char* mount_test_option(const char *haystack, const char *needle) { * struct mntent */ if (!haystack) - return false; + return NULL; zero(me); me.mnt_opts = (char*) haystack; @@ -320,7 +320,7 @@ static bool needs_quota(MountParameters *p) { } static int mount_add_fstab_links(Mount *m) { - const char *target, *after = NULL, *after2 = NULL; + const char *target, *after, *tu_wants = NULL; MountParameters *p; Unit *tu; int r; @@ -350,23 +350,27 @@ static int mount_add_fstab_links(Mount *m) { if (mount_is_network(p)) { target = SPECIAL_REMOTE_FS_TARGET; - after = SPECIAL_REMOTE_FS_PRE_TARGET; - after2 = SPECIAL_NETWORK_TARGET; + after = tu_wants = SPECIAL_REMOTE_FS_PRE_TARGET; } else { target = SPECIAL_LOCAL_FS_TARGET; after = SPECIAL_LOCAL_FS_PRE_TARGET; } - if ((r = manager_load_unit(UNIT(m)->manager, target, NULL, NULL, &tu)) < 0) + r = manager_load_unit(UNIT(m)->manager, target, NULL, NULL, &tu); + if (r < 0) return r; - if (after) - if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, after, NULL, true)) < 0) + if (tu_wants) { + r = unit_add_dependency_by_name(tu, UNIT_WANTS, tu_wants, NULL, true); + if (r < 0) return r; + } - if (after2) - if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, after2, NULL, true)) < 0) + if (after) { + r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, after, NULL, true); + if (r < 0) return r; + } if (automount) { Unit *am; @@ -1574,7 +1578,7 @@ static int mount_load_etc_fstab(Manager *m) { free(what); free(where); - if (r < 0) + if (k < 0) r = k; }