Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
*/
static int __pakfire_path_match_star(const char* p, const char* s) {
unsigned int stars = 0;
+ int r;
// Count how many stars we found
while (p && *p == '*') {
// Read as many characters as possible
default:
- continue;
+ r = pakfire_path_match(p, s);
+ if (r)
+ return r;
}
}
+ // The pattern has not entirely been consumed
+ if (*p)
+ return 0;
+
// If we reached the end of the string, * has consumed everything
return 1;
}
// Check for stars in the middle
ASSERT_TRUE(pakfire_path_match("/usr/lib64/*.so.*", "/usr/lib64/libblah.so.1"));
ASSERT_TRUE(pakfire_path_match("/usr/lib64/**/*.so", "/usr/lib64/blah/module.so"));
+ ASSERT_FALSE(pakfire_path_match("/usr/lib64/*.so.*", "/usr/lib64/beep"));
return EXIT_SUCCESS;