1
0
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:
Lennart Poettering 2022-08-29 11:11:10 +02:00
parent 6eeadaa141
commit 7fd0fb02a1

View File

@ -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) {