]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/main: port to log_syntax_parse_error()
authorMike Yuan <me@yhndnzj.com>
Sat, 8 Mar 2025 18:41:29 +0000 (19:41 +0100)
committerMike Yuan <me@yhndnzj.com>
Sat, 8 Mar 2025 19:40:24 +0000 (20:40 +0100)
src/core/main.c

index 8fce4b93aede3aaf0937796bd37079eb54eba1e7..02a28eba23b0fed337e401f55afbfd807f272b8d 100644 (file)
@@ -654,10 +654,8 @@ static int config_parse_oom_score_adjust(
         }
 
         r = parse_oom_score_adjust(rvalue, &oa);
-        if (r < 0) {
-                log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse the OOM score adjust value '%s', ignoring: %m", rvalue);
-                return 0;
-        }
+        if (r < 0)
+                return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
 
         arg_defaults.oom_score_adjust = oa;
         arg_defaults.oom_score_adjust_set = true;
@@ -693,10 +691,8 @@ static int config_parse_protect_system_pid1(
         }
 
         r = parse_boolean(rvalue);
-        if (r < 0) {
-                log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse ProtectSystem= argument '%s', ignoring: %m", rvalue);
-                return 0;
-        }
+        if (r < 0)
+                return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
 
         *v = r;
         return 0;
@@ -723,10 +719,8 @@ static int config_parse_crash_reboot(
         }
 
         r = parse_boolean(rvalue);
-        if (r < 0) {
-                log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse CrashReboot= argument '%s', ignoring: %m", rvalue);
-                return 0;
-        }
+        if (r < 0)
+                return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
 
         *v = r > 0 ? CRASH_REBOOT : CRASH_FREEZE;
         return 0;