summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-07-13 16:54:47 +0200
committerSergei Golubchik <serg@mariadb.org>2018-07-19 11:35:38 +0200
commitbd5cf02bbe7bce029b0275be1b15d2108806d5e9 (patch)
treec6b6cc0188a12995faa32d1b8cdb644c6fbadca2 /mysys
parent0b3e28a4cd3f8000eedb8ba190c0ea461544651a (diff)
downloadmariadb-git-bd5cf02bbe7bce029b0275be1b15d2108806d5e9.tar.gz
MDEV-11741 handler::ha_reset(): Assertion `bitmap_is_set_all(&table->s->all_set)' failed or server crash in mi_reset or buffer overrun or unexpected ER_CANT_REMOVE_ALL_FIELDS
MEMORY table could be renamed into a non-extistent database. rename() is documented to return ENOENT when the source file does not exist OR when the target directory not exist. Nonexistent source .frm file is ok (table can still exist in the engine), nonexistent target directory is not. Make my_rename to use ENOTDIR for the latter case. Make RENAME TABLE issue an appropriate error ("unknown database" instead of "unknown table")
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_rename.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mysys/my_rename.c b/mysys/my_rename.c
index 09e7eafa980..17f693629a8 100644
--- a/mysys/my_rename.c
+++ b/mysys/my_rename.c
@@ -39,7 +39,10 @@ int my_rename(const char *from, const char *to, myf MyFlags)
if (link(from, to) || unlink(from))
{
#endif
- my_errno=errno;
+ if (errno == ENOENT && !access(from, F_OK))
+ my_errno= ENOTDIR;
+ else
+ my_errno= errno;
error = -1;
if (MyFlags & (MY_FAE+MY_WME))
my_error(EE_LINK, MYF(ME_BELL+ME_WAITTANG),from,to,my_errno);