summaryrefslogtreecommitdiff
path: root/mysys/mf_pack.c
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2005-08-08 19:52:30 +0500
committerunknown <bar@mysql.com>2005-08-08 19:52:30 +0500
commit4112dc21765162ae3dfd356eedf480720eb32904 (patch)
tree9af79335dde7a3443f3f55a42ed6fd07728796af /mysys/mf_pack.c
parent062258ca7e6d457a978be0be73a6ba727f81b6c8 (diff)
downloadmariadb-git-4112dc21765162ae3dfd356eedf480720eb32904.tar.gz
Bug#5439 : mysql_server_init() crashes if ShiftJIS path is passed
(important for Adobe). mf_pack.c, mf_dirname.c, charset.c, my_sys.h: - adding fs_character_set() function on Windows - ignoring fake slashes which are just multibyte parts in several functions in /mysys Verified by Shu to work on WinXP and Win2k. Test is not possible, or very hard to do. include/my_sys.h: Bug#5439 : mysql_server_init() crashes if ShiftJIS path is passed (important for Adobe) - adding fs_character_set() function on Windows - ignoring fake slashes which are just multibyte parts in several functions in /mysys mysys/charset.c: d mysys/mf_dirname.c: d mysys/mf_pack.c: d
Diffstat (limited to 'mysys/mf_pack.c')
-rw-r--r--mysys/mf_pack.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c
index 86172f648f4..049aa59a578 100644
--- a/mysys/mf_pack.c
+++ b/mysys/mf_pack.c
@@ -124,6 +124,9 @@ uint cleanup_dirname(register my_string to, const char *from)
reg4 my_string start;
char parent[5], /* for "FN_PARENTDIR" */
buff[FN_REFLEN+1],*end_parentdir;
+#ifdef BACKSLASH_MBTAIL
+ CHARSET_INFO *fs= fs_character_set();
+#endif
DBUG_ENTER("cleanup_dirname");
DBUG_PRINT("enter",("from: '%s'",from));
@@ -141,6 +144,15 @@ uint cleanup_dirname(register my_string to, const char *from)
length=(uint) (strmov(parent+1,FN_PARENTDIR)-parent);
for (pos=start ; (*pos= *from_ptr++) != 0 ; pos++)
{
+#ifdef BACKSLASH_MBTAIL
+ uint l;
+ if (use_mb(fs) && (l= my_ismbchar(fs, from_ptr - 1, from_ptr + 2)))
+ {
+ for (l-- ; l ; *++pos= *from_ptr++, l--);
+ start= pos + 1; /* Don't look inside multi-byte char */
+ continue;
+ }
+#endif
if (*pos == '/')
*pos = FN_LIBCHAR;
if (*pos == FN_LIBCHAR)