From 6b7ca0ddfdc8e983fe867694967607bdbbe38d66 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Wed, 2 Jul 1997 22:37:44 +0000 Subject: Fixed wierd bug with lowercase accented character directories. Jeremy (jallison@whistle.com) (This used to be commit 1f0ecfe4fc612b214480f8b8462764964556ed5c) --- source3/lib/util.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/util.c b/source3/lib/util.c index 9ebfdca88e..b9b647395b 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -800,12 +800,15 @@ char *attrib_string(int mode) int StrCaseCmp(const char *s, const char *t) { /* compare until we run out of string, either t or s, or find a difference */ - while (*s && *t && tolower(*s) == tolower(*t)) + /* We *must* use toupper rather than tolower here due to the + asynchronous upper to lower mapping. + */ + while (*s && *t && toupper(*s) == toupper(*t)) { s++; t++; } - return(tolower(*s) - tolower(*t)); + return(toupper(*s) - toupper(*t)); } /******************************************************************* @@ -814,13 +817,16 @@ int StrCaseCmp(const char *s, const char *t) int StrnCaseCmp(const char *s, const char *t, int n) { /* compare until we run out of string, either t or s, or chars */ - while (n-- && *s && *t && tolower(*s) == tolower(*t)) + /* We *must* use toupper rather than tolower here due to the + asynchronous upper to lower mapping. + */ + while (n-- && *s && *t && toupper(*s) == toupper(*t)) { s++; t++; } /* not run out of chars - strings are different lengths */ - if (n) return(tolower(*s) - tolower(*t)); + if (n) return(toupper(*s) - toupper(*t)); /* identical up to where we run out of chars, and strings are same length */ return(0); -- cgit