X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=src%2Fshared%2Fgenerator.c;h=203e01318bd29a04d8923eb21bb9eeb586456783;hb=4349cd7c1d153c4ffa23cf1cff1644e0afa9bcf0;hp=81284995f5ab1c2d58ecf68513756abcf72ee3f0;hpb=2929b4a6ad8146d3ae2cc65d9b24ae3c4951c92f;p=thirdparty%2Fsystemd.git diff --git a/src/shared/generator.c b/src/shared/generator.c index 81284995f5a..203e01318bd 100644 --- a/src/shared/generator.c +++ b/src/shared/generator.c @@ -21,22 +21,30 @@ #include -#include "util.h" -#include "special.h" -#include "mkdir.h" -#include "unit-name.h" +#include "dropin.h" +#include "escape.h" +#include "fd-util.h" +#include "fileio.h" +#include "fstab-util.h" #include "generator.h" +#include "mkdir.h" +#include "mount-util.h" #include "path-util.h" -#include "fstab-util.h" -#include "fileio.h" -#include "dropin.h" +#include "special.h" +#include "string-util.h" +#include "unit-name.h" +#include "util.h" static int write_fsck_sysroot_service(const char *dir, const char *what) { - const char *unit; - _cleanup_free_ char *device = NULL; + _cleanup_free_ char *device = NULL, *escaped = NULL; _cleanup_fclose_ FILE *f = NULL; + const char *unit; int r; + escaped = cescape(what); + if (!escaped) + return log_oom(); + unit = strjoina(dir, "/systemd-fsck-root.service"); log_debug("Creating %s", unit); @@ -61,11 +69,12 @@ static int write_fsck_sysroot_service(const char *dir, const char *what) { "[Service]\n" "Type=oneshot\n" "RemainAfterExit=yes\n" - "ExecStart=/usr/lib/systemd/systemd-fsck %2$s\n" + "ExecStart=" SYSTEMD_FSCK_PATH " %4$s\n" "TimeoutSec=0\n", program_invocation_short_name, what, - device); + device, + escaped); r = fflush_and_check(f); if (r < 0) @@ -95,16 +104,17 @@ int generator_write_fsck_deps( if (!isempty(fstype) && !streq(fstype, "auto")) { r = fsck_exists(fstype); - if (r == -ENOENT) { + if (r < 0) + log_warning_errno(r, "Checking was requested for %s, but couldn't detect if fsck.%s may be used, proceeding: %m", what, fstype); + else if (r == 0) { /* treat missing check as essentially OK */ - log_debug_errno(r, "Checking was requested for %s, but fsck.%s does not exist: %m", what, fstype); + log_debug("Checking was requested for %s, but fsck.%s does not exist.", what, fstype); return 0; - } else if (r < 0) - return log_warning_errno(r, "Checking was requested for %s, but fsck.%s cannot be used: %m", what, fstype); + } } if (path_equal(where, "/")) { - char *lnk; + const char *lnk; lnk = strjoina(dir, "/" SPECIAL_LOCAL_FS_TARGET ".wants/systemd-fsck-root.service");