|
|
86b31d |
From 69ec7c9170e29fdf745fa282448d051edd1f88b2 Mon Sep 17 00:00:00 2001
|
|
|
86b31d |
From: Michal Sekletar <msekleta@redhat.com>
|
|
|
86b31d |
Date: Tue, 9 Aug 2022 11:41:04 +0200
|
|
|
86b31d |
Subject: [PATCH] core/load-fragment: move config_parse_sec_fix_0 to src/shared
|
|
|
86b31d |
|
|
|
86b31d |
(cherry picked from commit 4ee8176fe33bbcd0971c4583a0e7d1cc2a64ac06)
|
|
|
86b31d |
|
|
|
86b31d |
Related: #2122288
|
|
|
86b31d |
---
|
|
|
86b31d |
src/core/load-fragment.c | 33 ---------------------------------
|
|
|
86b31d |
src/core/load-fragment.h | 1 -
|
|
|
86b31d |
src/shared/conf-parser.c | 2 ++
|
|
|
86b31d |
src/shared/conf-parser.h | 1 +
|
|
|
86b31d |
4 files changed, 3 insertions(+), 34 deletions(-)
|
|
|
86b31d |
|
|
|
86b31d |
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
|
|
|
86b31d |
index c0b1fd4f91..53de7ff5e9 100644
|
|
|
86b31d |
--- a/src/core/load-fragment.c
|
|
|
86b31d |
+++ b/src/core/load-fragment.c
|
|
|
86b31d |
@@ -1865,39 +1865,6 @@ int config_parse_service_timeout(
|
|
|
86b31d |
return 0;
|
|
|
86b31d |
}
|
|
|
86b31d |
|
|
|
86b31d |
-int config_parse_sec_fix_0(
|
|
|
86b31d |
- const char *unit,
|
|
|
86b31d |
- const char *filename,
|
|
|
86b31d |
- unsigned line,
|
|
|
86b31d |
- const char *section,
|
|
|
86b31d |
- unsigned section_line,
|
|
|
86b31d |
- const char *lvalue,
|
|
|
86b31d |
- int ltype,
|
|
|
86b31d |
- const char *rvalue,
|
|
|
86b31d |
- void *data,
|
|
|
86b31d |
- void *userdata) {
|
|
|
86b31d |
-
|
|
|
86b31d |
- usec_t *usec = data;
|
|
|
86b31d |
- int r;
|
|
|
86b31d |
-
|
|
|
86b31d |
- assert(filename);
|
|
|
86b31d |
- assert(lvalue);
|
|
|
86b31d |
- assert(rvalue);
|
|
|
86b31d |
- assert(usec);
|
|
|
86b31d |
-
|
|
|
86b31d |
- /* This is pretty much like config_parse_sec(), except that this treats a time of 0 as infinity, for
|
|
|
86b31d |
- * compatibility with older versions of systemd where 0 instead of infinity was used as indicator to turn off a
|
|
|
86b31d |
- * timeout. */
|
|
|
86b31d |
-
|
|
|
86b31d |
- r = parse_sec_fix_0(rvalue, usec);
|
|
|
86b31d |
- if (r < 0) {
|
|
|
86b31d |
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse %s= parameter, ignoring: %s", lvalue, rvalue);
|
|
|
86b31d |
- return 0;
|
|
|
86b31d |
- }
|
|
|
86b31d |
-
|
|
|
86b31d |
- return 0;
|
|
|
86b31d |
-}
|
|
|
86b31d |
-
|
|
|
86b31d |
int config_parse_user_group_compat(
|
|
|
86b31d |
const char *unit,
|
|
|
86b31d |
const char *filename,
|
|
|
86b31d |
diff --git a/src/core/load-fragment.h b/src/core/load-fragment.h
|
|
|
86b31d |
index f9d34d484d..b964737f9e 100644
|
|
|
86b31d |
--- a/src/core/load-fragment.h
|
|
|
86b31d |
+++ b/src/core/load-fragment.h
|
|
|
86b31d |
@@ -95,7 +95,6 @@ CONFIG_PARSER_PROTOTYPE(config_parse_bus_name);
|
|
|
86b31d |
CONFIG_PARSER_PROTOTYPE(config_parse_exec_utmp_mode);
|
|
|
86b31d |
CONFIG_PARSER_PROTOTYPE(config_parse_working_directory);
|
|
|
86b31d |
CONFIG_PARSER_PROTOTYPE(config_parse_fdname);
|
|
|
86b31d |
-CONFIG_PARSER_PROTOTYPE(config_parse_sec_fix_0);
|
|
|
86b31d |
CONFIG_PARSER_PROTOTYPE(config_parse_user_group_compat);
|
|
|
86b31d |
CONFIG_PARSER_PROTOTYPE(config_parse_user_group_strv_compat);
|
|
|
86b31d |
CONFIG_PARSER_PROTOTYPE(config_parse_restrict_namespaces);
|
|
|
86b31d |
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
|
|
|
86b31d |
index 1f40f00c72..414dde2e3d 100644
|
|
|
86b31d |
--- a/src/shared/conf-parser.c
|
|
|
86b31d |
+++ b/src/shared/conf-parser.c
|
|
|
86b31d |
@@ -1286,3 +1286,5 @@ int config_parse_permille(const char* unit,
|
|
|
86b31d |
|
|
|
86b31d |
return 0;
|
|
|
86b31d |
}
|
|
|
86b31d |
+
|
|
|
86b31d |
+DEFINE_CONFIG_PARSE_PTR(config_parse_sec_fix_0, parse_sec_fix_0, usec_t, "Failed to parse time value");
|
|
|
86b31d |
diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h
|
|
|
86b31d |
index 375b2e5a74..56fd302db8 100644
|
|
|
86b31d |
--- a/src/shared/conf-parser.h
|
|
|
86b31d |
+++ b/src/shared/conf-parser.h
|
|
|
86b31d |
@@ -142,6 +142,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_ip_port);
|
|
|
86b31d |
CONFIG_PARSER_PROTOTYPE(config_parse_join_controllers);
|
|
|
86b31d |
CONFIG_PARSER_PROTOTYPE(config_parse_mtu);
|
|
|
86b31d |
CONFIG_PARSER_PROTOTYPE(config_parse_rlimit);
|
|
|
86b31d |
+CONFIG_PARSER_PROTOTYPE(config_parse_sec_fix_0);
|
|
|
86b31d |
|
|
|
86b31d |
typedef enum Disabled {
|
|
|
86b31d |
DISABLED_CONFIGURATION,
|