You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
1.6 KiB

From e591c1a47c067cd2d14dca569cc9f0cce9072200 Mon Sep 17 00:00:00 2001
From: Andrei Borzenkov <arvidjaar@gmail.com>
Date: Wed, 3 Jun 2015 20:50:59 +0300
Subject: [PATCH] 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
Cherry-picked from: fa05e97
Resolves: #1306126
---
src/shared/generator.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/shared/generator.c b/src/shared/generator.c
index 3af84a325c..be8e24eb49 100644
--- a/src/shared/generator.c
+++ b/src/shared/generator.c
@@ -35,8 +35,13 @@
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;
+ 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);
fflush(f);
if (ferror(f))