[PATCH v4 08/12] wildmatch: fix case-insensitive matching
- From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Date
- Oct 10, 2012, 10:40 UTC
- Message-ID
- <1349865651-31889-9-git-send-email-pclouds@gmail.com>
- In-Reply-To
- <1349865651-31889-1-git-send-email-pclouds@gmail.com>
dowild() does case insensitive matching by lower-casing the text. That means lower case letters in patterns imply case-insensitive matching, but upper case means exact matching.
We do not want that subtlety. Lower case pattern too so iwildmatch() always does what we expect it to do.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> --- wildmatch.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/wildmatch.c b/wildmatch.c index d18d721..b700631 100644 --- a/wildmatch.c +++ b/wildmatch.c @@ -72,6 +72,8 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case) return ABORT_ALL; if (force_lower_case && ISUPPER(t_ch)) t_ch = tolower(t_ch); + if (force_lower_case && ISUPPER(p_ch)) + p_ch = tolower(p_ch); switch (p_ch) { case '\\': /* Literal match with following character. Note that the test
-- 1.7.12.1.406.g6ab07c4