summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSinisa@sinisa.nasamreza.org <>2002-05-14 14:42:03 +0300
committerSinisa@sinisa.nasamreza.org <>2002-05-14 14:42:03 +0300
commit24b2d57f9cde70d57912bdd3ccefec2de6fb4fe5 (patch)
tree46c4316089560990a5fe4b53a2d6e165836bec63
parent3facae335e107c37fb18d915905a5739c72e3af0 (diff)
downloadmariadb-git-24b2d57f9cde70d57912bdd3ccefec2de6fb4fe5.tar.gz
DROP DATABASE with symlinks did not work before
-rw-r--r--Docs/manual.texi2
-rw-r--r--sql/sql_db.cc9
2 files changed, 10 insertions, 1 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index fcd77bf2867..34f22d2e587 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -46771,6 +46771,8 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet
@item
+Fixed bug in DROP DATABASE with symlink
+@item
Multi-table @code{DELETE}.
@item
Don't support old client protocols prior to MySQL 3.21 any more.
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 1e798a392b1..372dff85007 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -271,9 +271,16 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *org_path,
*/
if (!found_other_files)
{
- char tmp_path[FN_REFLEN];
+ char tmp_path[FN_REFLEN], lnk_path[FN_REFLEN];
char *path=unpack_filename(tmp_path,org_path);
#ifdef HAVE_READLINK
+ if (path[0] == FN_CURLIB)
+ {
+ int length = (strxmov(lnk_path,curr_dir,path + 2, NullS) - lnk_path) - 1;
+ path=lnk_path;
+ if (path[length] == FN_LIBCHAR)
+ path[length]='\0';
+ }
int linkcount = readlink(path,filePath,sizeof(filePath)-1);
if (linkcount > 0) // If the path was a symbolic link
{