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