b8c242
From 9dbb6564826a0def39a77ad292aecde75537d164 Mon Sep 17 00:00:00 2001
b8c242
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
b8c242
Date: Tue, 16 Oct 2018 14:49:36 +0200
b8c242
Subject: [PATCH] core: accept system mode emergency action specifiers with a
b8c242
 warning
b8c242
b8c242
Before we would only accept those "system" values, so there wasn't other
b8c242
chocie. Let's provide backwards compatiblity in case somebody made use of
b8c242
this functionality in user mode.
b8c242
b8c242
v2: use 'exit-force' not 'exit'
b8c242
v3: use error value in log_syntax
b8c242
(cherry picked from commit 469f76f170db39c72578e869ec7c087bb43f9350)
b8c242
b8c242
Related: #1860899
b8c242
---
b8c242
 src/core/load-fragment.c | 10 ++++++++++
b8c242
 1 file changed, 10 insertions(+)
b8c242
b8c242
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
b8c242
index c102ffb9f0..c0b1fd4f91 100644
b8c242
--- a/src/core/load-fragment.c
b8c242
+++ b/src/core/load-fragment.c
b8c242
@@ -4280,6 +4280,16 @@ int config_parse_emergency_action(
b8c242
 
b8c242
         r = parse_emergency_action(rvalue, MANAGER_IS_SYSTEM(m), x);
b8c242
         if (r < 0) {
b8c242
+                if (r == -EOPNOTSUPP && MANAGER_IS_USER(m)) {
b8c242
+                        /* Compat mode: remove for systemd 241. */
b8c242
+
b8c242
+                        log_syntax(unit, LOG_INFO, filename, line, r,
b8c242
+                                   "%s= in user mode specified as \"%s\", using \"exit-force\" instead.",
b8c242
+                                   lvalue, rvalue);
b8c242
+                        *x = EMERGENCY_ACTION_EXIT_FORCE;
b8c242
+                        return 0;
b8c242
+                }
b8c242
+
b8c242
                 if (r == -EOPNOTSUPP)
b8c242
                         log_syntax(unit, LOG_ERR, filename, line, r,
b8c242
                                    "%s= specified as %s mode action, ignoring: %s",