From de9a058bfe17e2cd4f628d712b70f7af854e58e5 Mon Sep 17 00:00:00 2001 From: "rburnett@build.mysql.com" <> Date: Fri, 24 Sep 2004 09:00:14 +0200 Subject: [PATCH 1/2] Bug #5539 SHOW DATABASES LIKE and symlinks sql_show.cc: Added wild card check to symdir block in mysql_find_files --- sql/sql_show.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 6784cd64465..d82af1a6242 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -204,7 +204,8 @@ mysql_find_files(THD *thd,List *files, const char *db,const char *path, if (end != buff && end[-1] == FN_LIBCHAR) end[-1]= 0; // Remove end FN_LIBCHAR if (!my_stat(buff, &status, MYF(0)) || - !MY_S_ISDIR(status.st_mode)) + !MY_S_ISDIR(status.st_mode) || + (wild && wild_compare(file->name, wild, 0))) continue; } else From 2bff96e2918c8e1810055fd9b80a7b709811c0b7 Mon Sep 17 00:00:00 2001 From: "rburnett@build.mysql.com" <> Date: Sat, 25 Sep 2004 18:43:07 +0200 Subject: [PATCH 2/2] Bug #5539 SHOW DATABASES LIKE and symlinks sql_show.cc: Made change suggested by Serge. REmoved else in mysql_find_files so symlink files fall through to the wildcard check --- sql/sql_show.cc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index d82af1a6242..2506033cda5 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -193,28 +193,23 @@ mysql_find_files(THD *thd,List *files, const char *db,const char *path, { /* Return databases */ #ifdef USE_SYMDIR char *ext; + char buff[FN_REFLEN]; if (my_use_symdir && !strcmp(ext=fn_ext(file->name), ".sym")) { /* Only show the sym file if it points to a directory */ - char buff[FN_REFLEN], *end; - MY_STAT status; + char *end; *ext=0; /* Remove extension */ unpack_dirname(buff, file->name); end= strend(buff); if (end != buff && end[-1] == FN_LIBCHAR) end[-1]= 0; // Remove end FN_LIBCHAR - if (!my_stat(buff, &status, MYF(0)) || - !MY_S_ISDIR(status.st_mode) || - (wild && wild_compare(file->name, wild, 0))) - continue; - } - else + if (!my_stat(buff, file->mystat, MYF(0))) + continue; + } #endif - { if (file->name[0] == '.' || !MY_S_ISDIR(file->mystat->st_mode) || (wild && wild_compare(file->name,wild, 0))) continue; - } } else {