|
|
1abbee |
From e591c1a47c067cd2d14dca569cc9f0cce9072200 Mon Sep 17 00:00:00 2001
|
|
|
e3fbdc |
From: Andrei Borzenkov <arvidjaar@gmail.com>
|
|
|
e3fbdc |
Date: Wed, 3 Jun 2015 20:50:59 +0300
|
|
|
e3fbdc |
Subject: [PATCH] fstab-generator: cescape device name in root-fsck service
|
|
|
e3fbdc |
|
|
|
e3fbdc |
We unescape ExecStart line when parsing it, so escape device name
|
|
|
e3fbdc |
before adding it to unit file.
|
|
|
e3fbdc |
|
|
|
e3fbdc |
fixes #50
|
|
|
e3fbdc |
|
|
|
e3fbdc |
Cherry-picked from: fa05e97
|
|
|
e3fbdc |
Resolves: #1306126
|
|
|
e3fbdc |
---
|
|
|
e3fbdc |
src/shared/generator.c | 10 ++++++++--
|
|
|
e3fbdc |
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
e3fbdc |
|
|
|
e3fbdc |
diff --git a/src/shared/generator.c b/src/shared/generator.c
|
|
|
e3fbdc |
index 3af84a3..be8e24e 100644
|
|
|
e3fbdc |
--- a/src/shared/generator.c
|
|
|
e3fbdc |
+++ b/src/shared/generator.c
|
|
|
e3fbdc |
@@ -35,8 +35,13 @@
|
|
|
e3fbdc |
static int write_fsck_sysroot_service(const char *dir, const char *what) {
|
|
|
e3fbdc |
const char *unit;
|
|
|
e3fbdc |
_cleanup_free_ char *device = NULL;
|
|
|
e3fbdc |
+ _cleanup_free_ char *escaped;
|
|
|
e3fbdc |
_cleanup_fclose_ FILE *f = NULL;
|
|
|
e3fbdc |
|
|
|
e3fbdc |
+ escaped = cescape(what);
|
|
|
e3fbdc |
+ if (!escaped)
|
|
|
e3fbdc |
+ return log_oom();
|
|
|
e3fbdc |
+
|
|
|
e3fbdc |
unit = strjoina(dir, "/systemd-fsck-root.service");
|
|
|
e3fbdc |
log_debug("Creating %s", unit);
|
|
|
e3fbdc |
|
|
|
e3fbdc |
@@ -61,11 +66,12 @@ static int write_fsck_sysroot_service(const char *dir, const char *what) {
|
|
|
e3fbdc |
"[Service]\n"
|
|
|
e3fbdc |
"Type=oneshot\n"
|
|
|
e3fbdc |
"RemainAfterExit=yes\n"
|
|
|
e3fbdc |
- "ExecStart=" SYSTEMD_FSCK_PATH " %2$s\n"
|
|
|
e3fbdc |
+ "ExecStart=" SYSTEMD_FSCK_PATH " %4$s\n"
|
|
|
e3fbdc |
"TimeoutSec=0\n",
|
|
|
e3fbdc |
program_invocation_short_name,
|
|
|
e3fbdc |
what,
|
|
|
e3fbdc |
- device);
|
|
|
e3fbdc |
+ device,
|
|
|
e3fbdc |
+ escaped);
|
|
|
e3fbdc |
|
|
|
e3fbdc |
fflush(f);
|
|
|
e3fbdc |
if (ferror(f))
|