You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

90 lines
3.5 KiB

From 009b55d532a66704072ca0c01e8dc218d318b520 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Tue, 9 Aug 2022 11:41:04 +0200
Subject: [PATCH] core/load-fragment: move config_parse_sec_fix_0 to src/shared
(cherry picked from commit 4ee8176fe33bbcd0971c4583a0e7d1cc2a64ac06)
Related: #2100464
---
src/core/load-fragment.c | 31 -------------------------------
src/core/load-fragment.h | 1 -
src/shared/conf-parser.c | 1 +
src/shared/conf-parser.h | 1 +
4 files changed, 2 insertions(+), 32 deletions(-)
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 0acc350389..e26581c1d5 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -2518,37 +2518,6 @@ int config_parse_service_timeout_abort(
return 0;
}
-int config_parse_sec_fix_0(
- const char *unit,
- const char *filename,
- unsigned line,
- const char *section,
- unsigned section_line,
- const char *lvalue,
- int ltype,
- const char *rvalue,
- void *data,
- void *userdata) {
-
- usec_t *usec = data;
- int r;
-
- assert(filename);
- assert(lvalue);
- assert(rvalue);
- assert(usec);
-
- /* This is pretty much like config_parse_sec(), except that this treats a time of 0 as infinity, for
- * compatibility with older versions of systemd where 0 instead of infinity was used as indicator to turn off a
- * timeout. */
-
- r = parse_sec_fix_0(rvalue, usec);
- if (r < 0)
- log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s= parameter, ignoring: %s", lvalue, rvalue);
-
- return 0;
-}
-
int config_parse_user_group_compat(
const char *unit,
const char *filename,
diff --git a/src/core/load-fragment.h b/src/core/load-fragment.h
index 26b8de28f7..4c302c43ec 100644
--- a/src/core/load-fragment.h
+++ b/src/core/load-fragment.h
@@ -114,7 +114,6 @@ CONFIG_PARSER_PROTOTYPE(config_parse_bus_name);
CONFIG_PARSER_PROTOTYPE(config_parse_exec_utmp_mode);
CONFIG_PARSER_PROTOTYPE(config_parse_working_directory);
CONFIG_PARSER_PROTOTYPE(config_parse_fdname);
-CONFIG_PARSER_PROTOTYPE(config_parse_sec_fix_0);
CONFIG_PARSER_PROTOTYPE(config_parse_user_group_compat);
CONFIG_PARSER_PROTOTYPE(config_parse_user_group_strv_compat);
CONFIG_PARSER_PROTOTYPE(config_parse_restrict_namespaces);
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index d19041207c..7bfed38834 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -1592,3 +1592,4 @@ int config_parse_in_addr_non_null(
DEFINE_CONFIG_PARSE(config_parse_percent, parse_percent, "Failed to parse percent value");
DEFINE_CONFIG_PARSE(config_parse_permyriad, parse_permyriad, "Failed to parse permyriad value");
+DEFINE_CONFIG_PARSE_PTR(config_parse_sec_fix_0, parse_sec_fix_0, usec_t, "Failed to parse time value");
diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h
index d686665532..fbfdbdb333 100644
--- a/src/shared/conf-parser.h
+++ b/src/shared/conf-parser.h
@@ -157,6 +157,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_ether_addrs);
CONFIG_PARSER_PROTOTYPE(config_parse_in_addr_non_null);
CONFIG_PARSER_PROTOTYPE(config_parse_percent);
CONFIG_PARSER_PROTOTYPE(config_parse_permyriad);
+CONFIG_PARSER_PROTOTYPE(config_parse_sec_fix_0);
typedef enum Disabled {
DISABLED_CONFIGURATION,