diff --git a/src/boot/bless-boot-generator.c b/src/boot/bless-boot-generator.c index 38b2c3ad7c..cf645e2416 100644 --- a/src/boot/bless-boot-generator.c +++ b/src/boot/bless-boot-generator.c @@ -7,7 +7,6 @@ #include "generator.h" #include "initrd-util.h" #include "log.h" -#include "mkdir.h" #include "special.h" #include "string-util.h" #include "virt.h" @@ -17,6 +16,7 @@ * boot as "good" if we manage to boot up far enough. */ static int run(const char *dest, const char *dest_early, const char *dest_late) { + assert(dest_early); if (in_initrd()) { log_debug("Skipping generator, running in the initrd."); @@ -34,7 +34,6 @@ static int run(const char *dest, const char *dest_early, const char *dest_late) } if (access(EFIVAR_PATH(EFI_LOADER_VARIABLE(LoaderBootCountPath)), F_OK) < 0) { - if (errno == ENOENT) { log_debug_errno(errno, "Skipping generator, not booted with boot counting in effect."); return 0; @@ -45,12 +44,7 @@ static int run(const char *dest, const char *dest_early, const char *dest_late) /* We pull this in from basic.target so that it ends up in all "regular" boot ups, but not in * rescue.target or even emergency.target. */ - const char *p = strjoina(dest_early, "/" SPECIAL_BASIC_TARGET ".wants/systemd-bless-boot.service"); - (void) mkdir_parents(p, 0755); - if (symlink(SYSTEM_DATA_UNIT_DIR "/systemd-bless-boot.service", p) < 0) - return log_error_errno(errno, "Failed to create symlink '%s': %m", p); - - return 0; + return generator_add_symlink(dest_early, SPECIAL_BASIC_TARGET, "wants", "systemd-bless-boot.service"); } DEFINE_MAIN_GENERATOR_FUNCTION(run); diff --git a/src/core/manager.c b/src/core/manager.c index fe7dc19672..6ac97e7660 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2203,8 +2203,8 @@ static int manager_dispatch_target_deps_queue(Manager *m) { if (n_targets < 0) return n_targets; - for (int i = 0; i < n_targets; i++) { - r = unit_add_default_target_dependency(u, targets[i]); + FOREACH_ARRAY(i, targets, n_targets) { + r = unit_add_default_target_dependency(u, *i); if (r < 0) return r; } diff --git a/src/core/target.c b/src/core/target.c index d9362b8b16..15866e9b1e 100644 --- a/src/core/target.c +++ b/src/core/target.c @@ -55,8 +55,8 @@ static int target_add_default_dependencies(Target *t) { if (n_others < 0) return n_others; - for (int i = 0; i < n_others; i++) { - r = unit_add_default_target_dependency(others[i], UNIT(t)); + FOREACH_ARRAY(i, others, n_others) { + r = unit_add_default_target_dependency(*i, UNIT(t)); if (r < 0) return r; } diff --git a/src/core/transaction.c b/src/core/transaction.c index a81c40fb06..b5c6348b6f 100644 --- a/src/core/transaction.c +++ b/src/core/transaction.c @@ -446,10 +446,10 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi * the graph over 'before' edges in the actual job execution order. We traverse over both unit * ordering dependencies and we test with job_compare() whether it is the 'before' edge in the job * execution ordering. */ - for (size_t d = 0; d < ELEMENTSOF(directions); d++) { + FOREACH_ARRAY(d, directions, ELEMENTSOF(directions)) { Unit *u; - UNIT_FOREACH_DEPENDENCY(u, j->unit, directions[d]) { + UNIT_FOREACH_DEPENDENCY(u, j->unit, *d) { Job *o; /* Is there a job for this unit? */ @@ -463,7 +463,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi } /* Cut traversing if the job j is not really *before* o. */ - if (job_compare(j, o, directions[d]) >= 0) + if (job_compare(j, o, *d) >= 0) continue; r = transaction_verify_order_one(tr, o, j, generation, e); diff --git a/units/systemd-boot-check-no-failures.service.in b/units/systemd-boot-check-no-failures.service.in index eaadd0e554..2e17cb9c8e 100644 --- a/units/systemd-boot-check-no-failures.service.in +++ b/units/systemd-boot-check-no-failures.service.in @@ -12,8 +12,6 @@ Description=Check if Any System Units Failed Documentation=man:systemd-boot-check-no-failures.service(8) After=default.target graphical.target multi-user.target Before=boot-complete.target -Conflicts=shutdown.target -Before=shutdown.target [Service] Type=oneshot