diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 02:19:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 02:19:38 +0000 |
commit | 68aafb2658b298c23ed1725b69f5474bee5ee38c (patch) | |
tree | c383770976489dbeeef85ef7bc668da64a242b14 /src/core/load-fragment.c | |
parent | Adding upstream version 252.23. (diff) | |
download | systemd-68aafb2658b298c23ed1725b69f5474bee5ee38c.tar.xz systemd-68aafb2658b298c23ed1725b69f5474bee5ee38c.zip |
Adding upstream version 252.25.upstream/252.25
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r-- | src/core/load-fragment.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 5f4d4b0..11166f9 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -54,6 +54,7 @@ #include "path-util.h" #include "percent-util.h" #include "process-util.h" +#include "reboot-util.h" #if HAVE_SECCOMP #include "seccomp-util.h" #endif @@ -360,6 +361,40 @@ int config_parse_unit_string_printf( return config_parse_string(unit, filename, line, section, section_line, lvalue, ltype, k, data, userdata); } +int config_parse_reboot_parameter( + 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) { + + _cleanup_free_ char *k = NULL; + const Unit *u = ASSERT_PTR(userdata); + int r; + + assert(filename); + assert(line); + assert(rvalue); + + r = unit_full_printf(u, rvalue, &k); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to resolve unit specifiers in '%s', ignoring: %m", rvalue); + return 0; + } + + if (!reboot_parameter_is_valid(k)) { + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid reboot parameter '%s', ignoring.", k); + return 0; + } + + return config_parse_string(unit, filename, line, section, section_line, lvalue, ltype, k, data, userdata); +} + int config_parse_unit_strv_printf( const char *unit, const char *filename, |