summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2016-06-16 12:35:14 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2016-06-16 12:35:14 +0400
commit0e50b924820d365bcc1659eec2cad606f6887597 (patch)
treece47e88b6ccc9e94e0a08b01f35bdf8c5dd5aebb /sql/sql_show.cc
parent732e2694058788c14b55db052dedc102ac21d1bc (diff)
downloadmariadb-git-0e50b924820d365bcc1659eec2cad606f6887597.tar.gz
MDEV-9969 mysql_install_db error processing ignore_db_dirs.
Check for same directories in the list added.
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc24
1 files changed, 21 insertions, 3 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index b8926b986b0..931011dcbc2 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -720,12 +720,24 @@ ignore_db_dirs_process_additions()
for (i= 0; i < ignore_db_dirs_array.elements; i++)
{
get_dynamic(&ignore_db_dirs_array, (uchar *) &dir, i);
- if (my_hash_insert(&ignore_db_dirs_hash, (uchar *) dir))
+ if (my_hash_insert(&ignore_db_dirs_hash, (uchar *)dir))
+ {
+ /* ignore duplicates from the config file */
+ if (my_hash_search(&ignore_db_dirs_hash, (uchar *)dir->str, dir->length))
+ {
+ sql_print_warning("Duplicate ignore-db-dir directory name '%.*s' "
+ "found in the config file(s). Ignoring the duplicate.",
+ (int) dir->length, dir->str);
+ my_free(dir);
+ goto continue_loop;
+ }
+
return true;
+ }
ptr= strnmov(ptr, dir->str, dir->length);
- if (i + 1 < ignore_db_dirs_array.elements)
- ptr= strmov(ptr, ",");
+ *(ptr++)= ',';
+continue_loop:
/*
Set the transferred array element to NULL to avoid double free
in case of error.
@@ -734,6 +746,12 @@ ignore_db_dirs_process_additions()
set_dynamic(&ignore_db_dirs_array, (uchar *) &dir, i);
}
+ if (ptr > opt_ignore_db_dirs)
+ {
+ ptr--;
+ DBUG_ASSERT(*ptr == ',');
+ }
+
/* make sure the string is terminated */
DBUG_ASSERT(ptr - opt_ignore_db_dirs <= (ptrdiff_t) len);
*ptr= 0;