mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 09:58:07 +02:00
core: accept %NULL argument to nm_wildcard_match_check()
%NULL means that the string is unknown. The pattern should still match if there are no positive matches that want to match against the string. For example, the nm_device_get_driver() might return NULL. If we have a match.driver setting, we still need to handle that somehow that it makes sense.
This commit is contained in:
parent
ace437338d
commit
623cf7c9a3
1 changed files with 9 additions and 5 deletions
|
|
@ -1703,11 +1703,13 @@ nm_wildcard_match_check (const char *str,
|
|||
const char *const *patterns,
|
||||
guint num_patterns)
|
||||
{
|
||||
guint i, neg = 0;
|
||||
gsize i, neg = 0;
|
||||
|
||||
for (i = 0; i < num_patterns; i++) {
|
||||
if (patterns[i][0] == '!') {
|
||||
neg++;
|
||||
if (!str)
|
||||
continue;
|
||||
if (!fnmatch (patterns[i] + 1, str, 0))
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -1716,10 +1718,12 @@ nm_wildcard_match_check (const char *str,
|
|||
if (neg == num_patterns)
|
||||
return TRUE;
|
||||
|
||||
for (i = 0; i < num_patterns; i++) {
|
||||
if ( patterns[i][0] != '!'
|
||||
&& !fnmatch (patterns[i], str, 0))
|
||||
return TRUE;
|
||||
if (str) {
|
||||
for (i = 0; i < num_patterns; i++) {
|
||||
if ( patterns[i][0] != '!'
|
||||
&& !fnmatch (patterns[i], str, 0))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue