while (*p == '*')
p++;
- do {
+ for (; *h != '\0'; h++)
/* Try matching haystack with remaining pattern. */
if (efi_fnmatch_internal(p, h, max_depth - 1))
return true;
- /* Otherwise, we match one char here. */
- h++;
- } while (*h != '\0');
-
/* End of haystack. Pattern needs to be empty too for a match. */
return *p == '\0';
TEST_FNMATCH_ONE("*", "123", true);
TEST_FNMATCH_ONE("**", "abcd", true);
TEST_FNMATCH_ONE("*b*", "abcd", true);
+ TEST_FNMATCH_ONE("abc*d", "abc", false);
TEST_FNMATCH_ONE("*.conf", "arch.conf", true);
TEST_FNMATCH_ONE("debian-*.conf", "debian-wheezy.conf", true);
TEST_FNMATCH_ONE("debian-*.*", "debian-wheezy.efi", true);