dryang / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
ff2b41
From 1be885f0e0f7023d1adc09fb0b247935c1a0b3bd Mon Sep 17 00:00:00 2001
ff2b41
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
ff2b41
Date: Sat, 28 Jan 2017 21:18:31 -0500
ff2b41
Subject: [PATCH] systemctl: always avoid being killed when doing switch-root
ff2b41
ff2b41
The same logic as described in acc28e2e3037d689d6481e applies to any time we are
ff2b41
switching root, to just set the flag unconditionally.
ff2b41
ff2b41
(cherry picked from commit b3ad0ff48c154ed056a6bded2adac609395a9439)
ff2b41
ff2b41
Related: #1754053
ff2b41
---
ff2b41
 src/systemctl/systemctl.c | 8 +++-----
ff2b41
 1 file changed, 3 insertions(+), 5 deletions(-)
ff2b41
ff2b41
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
ff2b41
index f84b92ccbe..0928e2972a 100644
ff2b41
--- a/src/systemctl/systemctl.c
ff2b41
+++ b/src/systemctl/systemctl.c
ff2b41
@@ -5062,11 +5062,9 @@ static int switch_root(sd_bus *bus, char **args) {
ff2b41
         }
ff2b41
 
ff2b41
         /* Instruct PID1 to exclude us from its killing spree applied during
ff2b41
-         * the transition from the initrd to the main system otherwise we would
ff2b41
-         * exit with a failure status even though the switch to the new root
ff2b41
-         * has succeed. */
ff2b41
-        if (in_initrd())
ff2b41
-                argv_cmdline[0] = '@';
ff2b41
+         * the transition. Otherwise we would exit with a failure status even
ff2b41
+         * though the switch to the new root has succeed. */
ff2b41
+        argv_cmdline[0] = '@';
ff2b41
 
ff2b41
         log_debug("Switching root - root: %s; init: %s", root, strna(init));
ff2b41