]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: always avoid being killed when doing switch-root
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 29 Jan 2017 02:18:31 +0000 (21:18 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 31 Jan 2017 06:34:40 +0000 (01:34 -0500)
The same logic as described in acc28e2e3037d689d6481e applies to any time we are
switching root, to just set the flag unconditionally.

src/systemctl/systemctl.c

index 41e8d6075a2d1709172fb5e78a9706289b382b6b..6eed921ecf50b0727bce9f42a8ab2cc5c6bde9c2 100644 (file)
@@ -5655,11 +5655,9 @@ static int switch_root(int argc, char *argv[], void *userdata) {
         }
 
         /* Instruct PID1 to exclude us from its killing spree applied during
-         * the transition from the initrd to the main system otherwise we would
-         * exit with a failure status even though the switch to the new root
-         * has succeed. */
-        if (in_initrd())
-                argv_cmdline[0] = '@';
+         * the transition. Otherwise we would exit with a failure status even
+         * though the switch to the new root has succeed. */
+        argv_cmdline[0] = '@';
 
         r = acquire_bus(BUS_MANAGER, &bus);
         if (r < 0)