summaryrefslogtreecommitdiff
path: root/src/shared/condition.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-08-26 16:59:47 +0200
committerLennart Poettering <lennart@poettering.net>2022-09-01 23:15:14 +0200
commit8daa674090d47320cd7ed6abb72dfdc0c4aa60f3 (patch)
treefaede8c24e242c9c5823defaad9eef9cc9856388 /src/shared/condition.c
parent57610982f73162ec37b1de03734250bb5a3222da (diff)
downloadsystemd-8daa674090d47320cd7ed6abb72dfdc0c4aa60f3.tar.gz
condition: allow fnmatch compares for ConditionOSRelease=
We support this for smbios matches, hence do so for /etc/os-release matches too.
Diffstat (limited to 'src/shared/condition.c')
-rw-r--r--src/shared/condition.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/shared/condition.c b/src/shared/condition.c
index db7a02db7d..4e5702bc41 100644
--- a/src/shared/condition.c
+++ b/src/shared/condition.c
@@ -257,7 +257,7 @@ static int condition_test_osrelease(Condition *c, char **env) {
/* parse_compare_operator() needs the string to start with the comparators */
word = condition;
- r = extract_first_word(&word, &key, "!<=>", EXTRACT_RETAIN_SEPARATORS);
+ r = extract_first_word(&word, &key, "!<=>$", EXTRACT_RETAIN_SEPARATORS);
if (r < 0)
return log_debug_errno(r, "Failed to parse parameter: %m");
/* The os-release spec mandates env-var-like key names */
@@ -266,7 +266,7 @@ static int condition_test_osrelease(Condition *c, char **env) {
"Failed to parse parameter, key/value format expected: %m");
/* Do not allow whitespace after the separator, as that's not a valid os-release format */
- operator = parse_compare_operator(&word, COMPARE_EQUAL_BY_STRING);
+ operator = parse_compare_operator(&word, COMPARE_ALLOW_FNMATCH|COMPARE_EQUAL_BY_STRING);
if (operator < 0 || isempty(word) || strchr(WHITESPACE, *word) != NULL)
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL),
"Failed to parse parameter, key/value format expected: %m");