]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: accept system mode emergency action specifiers with a warning
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 16 Oct 2018 12:49:36 +0000 (14:49 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 17 Oct 2018 17:31:50 +0000 (19:31 +0200)
Before we would only accept those "system" values, so there wasn't other
chocie. Let's provide backwards compatiblity in case somebody made use of
this functionality in user mode.

v2: use 'exit-force' not 'exit'
v3: use error value in log_syntax

src/core/load-fragment.c

index b4299c5882cc85866b1201653f3bfc92d2477485..bfd1d5b15f09bd2d0865584c77c86866ba80905c 100644 (file)
@@ -4212,6 +4212,16 @@ int config_parse_emergency_action(
 
         r = parse_emergency_action(rvalue, MANAGER_IS_SYSTEM(m), x);
         if (r < 0) {
+                if (r == -EOPNOTSUPP && MANAGER_IS_USER(m)) {
+                        /* Compat mode: remove for systemd 241. */
+
+                        log_syntax(unit, LOG_INFO, filename, line, r,
+                                   "%s= in user mode specified as \"%s\", using \"exit-force\" instead.",
+                                   lvalue, rvalue);
+                        *x = EMERGENCY_ACTION_EXIT_FORCE;
+                        return 0;
+                }
+
                 if (r == -EOPNOTSUPP)
                         log_syntax(unit, LOG_ERR, filename, line, r,
                                    "%s= specified as %s mode action, ignoring: %s",