mirror of
https://github.com/systemd/systemd.git
synced 2025-02-18 21:57:48 +03:00
condition: properly handle fnmatch() errors in ConditionHost
This commit is contained in:
parent
6eeadaa141
commit
7fd0fb02a1
@ -716,7 +716,13 @@ static int condition_test_host(Condition *c, char **env) {
|
||||
if (!h)
|
||||
return -ENOMEM;
|
||||
|
||||
return fnmatch(c->parameter, h, FNM_CASEFOLD) == 0;
|
||||
r = fnmatch(c->parameter, h, FNM_CASEFOLD);
|
||||
if (r == FNM_NOMATCH)
|
||||
return false;
|
||||
if (r != 0)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "fnmatch() failed.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int condition_test_ac_power(Condition *c, char **env) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user