From: Andrei Borzenkov Date: Wed, 3 Jun 2015 17:50:59 +0000 (+0300) Subject: fstab-generator: cescape device name in root-fsck service X-Git-Tag: v226.4~1^2~322 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=f13b8e8f08bbf28266c5e2819ae3ed148e9f98e3;hp=180a9fcdf2c708707783debad45418f488619138;p=elogind.git fstab-generator: cescape device name in root-fsck service We unescape ExecStart line when parsing it, so escape device name before adding it to unit file. fixes #50 --- diff --git a/src/shared/generator.c b/src/shared/generator.c index 807569a1b..e58bbea77 100644 --- a/src/shared/generator.c +++ b/src/shared/generator.c @@ -34,9 +34,14 @@ static int write_fsck_sysroot_service(const char *dir, const char *what) { const char *unit; _cleanup_free_ char *device = NULL; + _cleanup_free_ char *escaped; _cleanup_fclose_ FILE *f = NULL; int r; + escaped = cescape(what); + if (!escaped) + return log_oom(); + unit = strjoina(dir, "/systemd-fsck-root.service"); log_debug("Creating %s", unit); @@ -61,11 +66,12 @@ static int write_fsck_sysroot_service(const char *dir, const char *what) { "[Service]\n" "Type=oneshot\n" "RemainAfterExit=yes\n" - "ExecStart=" SYSTEMD_FSCK_PATH " %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)