From b59d565605269db0a1b39da5e2aa7b686c8ca87a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Oct 2005 18:01:23 +0400 Subject: [PATCH 1/2] Fix for BUG#4375: Windows specific directories are copied during replication. Modified my_dir(). Now this function skips hidden and system files which sometimes are created by Windows. NOTE. The fix is similar to the previuos one (05 July 2004) except for correct setting of the 'attrib' variable value (within the previous fix this variable was left uninitialized when my_dir() was called with My_flags & MY_WANT_STAT == 0). mysys/my_lib.c: Modified my_dir(). Now this function skips hidden and system files which sometimes are created by Windows. --- mysys/my_lib.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/mysys/my_lib.c b/mysys/my_lib.c index c3b0b57e549..1908c70f407 100644 --- a/mysys/my_lib.c +++ b/mysys/my_lib.c @@ -426,6 +426,18 @@ MY_DIR *my_dir(const char *path, myf MyFlags) do { +#ifdef __BORLANDC__ + attrib= find.ff_attrib; +#else + attrib= find.attrib; + /* + Do not show hidden and system files which Windows sometimes create. + Note. Because Borland's findfirst() is called with the third + argument = 0 hidden/system files are excluded from the search. + */ + if (attrib & (_A_HIDDEN | _A_SYSTEM)) + continue; +#endif #ifdef __BORLANDC__ if (!(finfo.name= strdup_root(names_storage, find.ff_name))) goto error; @@ -442,11 +454,10 @@ MY_DIR *my_dir(const char *path, myf MyFlags) bzero(finfo.mystat, sizeof(MY_STAT)); #ifdef __BORLANDC__ finfo.mystat->st_size=find.ff_fsize; - mode=MY_S_IREAD; attrib=find.ff_attrib; #else finfo.mystat->st_size=find.size; - mode=MY_S_IREAD; attrib=find.attrib; #endif + mode=MY_S_IREAD; if (!(attrib & _A_RDONLY)) mode|=MY_S_IWRITE; if (attrib & _A_SUBDIR) From f4911002726902f44cb7ebfa7487e0b84cf1b896 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 20 Oct 2005 10:30:51 +0500 Subject: [PATCH 2/2] charset.c: Bug#13238 mysqldump and mysqladmin hangs Avoid recursion into init_available_charsets. Serg's version didn't work for me: I got double mutex locking. Pushing this version instead (It was approved by Serg anyway) mysys/charset.c: Bug#13238 mysqldump and mysqladmin hangs Avoid recursion into init_available_charsets. Serg's version didn't work for me: I got double mutex locking. Pushing this version instead (It was approved by Serg anyway) --- mysys/charset.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/mysys/charset.c b/mysys/charset.c index 3a39fce9437..665f2efecd8 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -38,6 +38,22 @@ my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2) } +static uint +get_collation_number_internal(const char *name) +{ + CHARSET_INFO **cs; + for (cs= all_charsets; + cs < all_charsets+array_elements(all_charsets)-1 ; + cs++) + { + if ( cs[0] && cs[0]->name && + !my_strcasecmp(&my_charset_latin1, cs[0]->name, name)) + return cs[0]->number; + } + return 0; +} + + static my_bool init_state_maps(CHARSET_INFO *cs) { uint i; @@ -189,7 +205,8 @@ static my_bool simple_cs_is_full(CHARSET_INFO *cs) static int add_collation(CHARSET_INFO *cs) { - if (cs->name && (cs->number || (cs->number=get_collation_number(cs->name)))) + if (cs->name && (cs->number || + (cs->number=get_collation_number_internal(cs->name)))) { if (!all_charsets[cs->number]) { @@ -419,18 +436,8 @@ void free_charsets(void) uint get_collation_number(const char *name) { - CHARSET_INFO **cs; init_available_charsets(MYF(0)); - - for (cs= all_charsets; - cs < all_charsets+array_elements(all_charsets)-1 ; - cs++) - { - if ( cs[0] && cs[0]->name && - !my_strcasecmp(&my_charset_latin1, cs[0]->name, name)) - return cs[0]->number; - } - return 0; /* this mimics find_type() */ + return get_collation_number_internal(name); }