diff --git a/lib/suppressions.cpp b/lib/suppressions.cpp index eb076185e..8c65621cf 100644 --- a/lib/suppressions.cpp +++ b/lib/suppressions.cpp @@ -278,17 +278,17 @@ bool Suppressions::matchglob(const std::string &pattern, const std::string &name switch (*p) { case '*': // Step forward until we match the next character after * - while (*n != '\0' && *n != p[1] && *n != '\\' && *n != '/') { + while (*n != '\0' && *n != p[1]) { n++; } - if (*n != '\0' && *n != '/') { + if (*n != '\0') { // If this isn't the last possibility, save it for later backtrack.push(std::make_pair(p, n)); } break; case '?': // Any character matches unless we're at the end of the name - if (*n != '\0' && *n != '\\' && *n != '/') { + if (*n != '\0') { n++; } else { matching = false; diff --git a/test/testsuppressions.cpp b/test/testsuppressions.cpp index 8e42952e4..7a626a918 100644 --- a/test/testsuppressions.cpp +++ b/test/testsuppressions.cpp @@ -514,7 +514,7 @@ private: ASSERT_EQUALS(true, Suppressions::matchglob("*y*", "xyz")); ASSERT_EQUALS(true, Suppressions::matchglob("*y*", "yz")); ASSERT_EQUALS(false, Suppressions::matchglob("*y*", "abc")); - ASSERT_EQUALS(false, Suppressions::matchglob("*", "x/y/z")); + ASSERT_EQUALS(true, Suppressions::matchglob("*", "x/y/z")); ASSERT_EQUALS(true, Suppressions::matchglob("*/y/z", "x/y/z")); ASSERT_EQUALS(false, Suppressions::matchglob("?", "xyz"));