summaryrefslogtreecommitdiff
path: root/sql/ha_ndbcluster.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/ha_ndbcluster.cc')
-rw-r--r--sql/ha_ndbcluster.cc46
1 files changed, 25 insertions, 21 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 9be4bfba9ab..c6b48c5b744 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -1247,7 +1247,7 @@ int ha_ndbcluster::add_index_handle(THD *thd, NDBDICT *dict, KEY *key_info,
}
if (idx_type == UNIQUE_ORDERED_INDEX || idx_type == UNIQUE_INDEX)
{
- char unique_index_name[FN_LEN];
+ char unique_index_name[FN_LEN + 1];
static const char* unique_suffix= "$unique";
m_has_unique_index= TRUE;
strxnmov(unique_index_name, FN_LEN, index_name, unique_suffix, NullS);
@@ -5152,7 +5152,7 @@ int ha_ndbcluster::create(const char *name,
uchar *data= NULL, *pack_data= NULL;
bool create_from_engine= (create_info->table_options & HA_OPTION_CREATE_FROM_ENGINE);
bool is_truncate= (thd->lex->sql_command == SQLCOM_TRUNCATE);
- char tablespace[FN_LEN];
+ char tablespace[FN_LEN + 1];
NdbDictionary::Table::SingleUserMode single_user_mode= NdbDictionary::Table::SingleUserModeLocked;
DBUG_ENTER("ha_ndbcluster::create");
@@ -5615,7 +5615,7 @@ int ha_ndbcluster::create_index(const char *name, KEY *key_info,
NDB_INDEX_TYPE idx_type, uint idx_no)
{
int error= 0;
- char unique_name[FN_LEN];
+ char unique_name[FN_LEN + 1];
static const char* unique_suffix= "$unique";
DBUG_ENTER("ha_ndbcluster::create_ordered_index");
DBUG_PRINT("info", ("Creating index %u: %s", idx_no, name));
@@ -6664,7 +6664,7 @@ int ndbcluster_discover(handlerton *hton, THD* thd, const char *db,
size_t len;
uchar* data= NULL;
Ndb* ndb;
- char key[FN_REFLEN];
+ char key[FN_REFLEN + 1];
DBUG_ENTER("ndbcluster_discover");
DBUG_PRINT("enter", ("db: %s, name: %s", db, name));
@@ -6675,7 +6675,7 @@ int ndbcluster_discover(handlerton *hton, THD* thd, const char *db,
ERR_RETURN(ndb->getNdbError());
}
NDBDICT* dict= ndb->getDictionary();
- build_table_filename(key, sizeof(key), db, name, "", 0);
+ build_table_filename(key, sizeof(key) - 1, db, name, "", 0);
/* ndb_share reference temporary */
NDB_SHARE *share= get_share(key, 0, FALSE);
if (share)
@@ -6840,9 +6840,9 @@ int ndbcluster_drop_database_impl(const char *path)
drop_list.push_back(thd->strdup(elmt.name));
}
// Drop any tables belonging to database
- char full_path[FN_REFLEN];
+ char full_path[FN_REFLEN + 1];
char *tmp= full_path +
- build_table_filename(full_path, sizeof(full_path), dbname, "", "", 0);
+ build_table_filename(full_path, sizeof(full_path) - 1, dbname, "", "", 0);
if (ndb->setDatabaseName(dbname))
{
ERR_RETURN(ndb->getNdbError());
@@ -6911,7 +6911,7 @@ int ndb_create_table_from_engine(THD *thd, const char *db,
int ndbcluster_find_all_files(THD *thd)
{
Ndb* ndb;
- char key[FN_REFLEN];
+ char key[FN_REFLEN + 1];
NDBDICT *dict;
int unhandled, retries= 5, skipped;
DBUG_ENTER("ndbcluster_find_all_files");
@@ -6969,7 +6969,7 @@ int ndbcluster_find_all_files(THD *thd)
/* check if database exists */
char *end= key +
- build_table_filename(key, sizeof(key), elmt.database, "", "", 0);
+ build_table_filename(key, sizeof(key) - 1, elmt.database, "", "", 0);
if (my_access(key, F_OK))
{
/* no such database defined, skip table */
@@ -7050,7 +7050,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
{ // extra bracket to avoid gcc 2.95.3 warning
uint i;
Ndb* ndb;
- char name[FN_REFLEN];
+ char name[FN_REFLEN + 1];
HASH ndb_tables, ok_tables;
NDBDICT::List list;
@@ -7120,7 +7120,8 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
DBUG_PRINT("info", ("%s", file_name->str));
if (hash_search(&ndb_tables, (uchar*) file_name->str, file_name->length))
{
- build_table_filename(name, sizeof(name), db, file_name->str, reg_ext, 0);
+ build_table_filename(name, sizeof(name) - 1, db,
+ file_name->str, reg_ext, 0);
if (my_access(name, F_OK))
{
pthread_mutex_lock(&LOCK_open);
@@ -7142,7 +7143,8 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
}
// Check for .ndb file with this name
- build_table_filename(name, sizeof(name), db, file_name->str, ha_ndb_ext, 0);
+ build_table_filename(name, sizeof(name) - 1, db,
+ file_name->str, ha_ndb_ext, 0);
DBUG_PRINT("info", ("Check access for %s", name));
if (my_access(name, F_OK))
{
@@ -7185,7 +7187,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
/* setup logging to binlog for all discovered tables */
{
char *end, *end1= name +
- build_table_filename(name, sizeof(name), db, "", "", 0);
+ build_table_filename(name, sizeof(name) - 1, db, "", "", 0);
for (i= 0; i < ok_tables.records; i++)
{
file_name_str= (char*)hash_element(&ok_tables, i);
@@ -7207,7 +7209,8 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
file_name_str= (char*) hash_element(&ndb_tables, i);
if (!hash_search(&ok_tables, (uchar*) file_name_str, strlen(file_name_str)))
{
- build_table_filename(name, sizeof(name), db, file_name_str, reg_ext, 0);
+ build_table_filename(name, sizeof(name) - 1,
+ db, file_name_str, reg_ext, 0);
if (my_access(name, F_OK))
{
DBUG_PRINT("info", ("%s must be discovered", file_name_str));
@@ -7587,7 +7590,7 @@ void ndbcluster_print_error(int error, const NdbOperation *error_op)
void ha_ndbcluster::set_dbname(const char *path_name, char *dbname)
{
char *end, *ptr, *tmp_name;
- char tmp_buff[FN_REFLEN];
+ char tmp_buff[FN_REFLEN + 1];
tmp_name= tmp_buff;
/* Scan name from the end */
@@ -7613,7 +7616,7 @@ void ha_ndbcluster::set_dbname(const char *path_name, char *dbname)
ptr++;
}
#endif
- filename_to_tablename(tmp_name, dbname, FN_REFLEN);
+ filename_to_tablename(tmp_name, dbname, sizeof(tmp_buff) - 1);
}
/**
@@ -7633,7 +7636,7 @@ void
ha_ndbcluster::set_tabname(const char *path_name, char * tabname)
{
char *end, *ptr, *tmp_name;
- char tmp_buff[FN_REFLEN];
+ char tmp_buff[FN_REFLEN + 1];
tmp_name= tmp_buff;
/* Scan name from the end */
@@ -7654,7 +7657,7 @@ ha_ndbcluster::set_tabname(const char *path_name, char * tabname)
ptr++;
}
#endif
- filename_to_tablename(tmp_name, tabname, FN_REFLEN);
+ filename_to_tablename(tmp_name, tabname, sizeof(tmp_buff) - 1);
}
/**
@@ -7840,11 +7843,12 @@ uint8 ha_ndbcluster::table_cache_type()
uint ndb_get_commitcount(THD *thd, char *dbname, char *tabname,
Uint64 *commit_count)
{
- char name[FN_REFLEN];
+ char name[FN_REFLEN + 1];
NDB_SHARE *share;
DBUG_ENTER("ndb_get_commitcount");
- build_table_filename(name, sizeof(name), dbname, tabname, "", 0);
+ build_table_filename(name, sizeof(name) - 1,
+ dbname, tabname, "", 0);
DBUG_PRINT("enter", ("name: %s", name));
pthread_mutex_lock(&ndbcluster_mutex);
if (!(share=(NDB_SHARE*) hash_search(&ndbcluster_open_tables,
@@ -9950,7 +9954,7 @@ bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *create_info,
ai=1;
}
- char tablespace_name[FN_LEN];
+ char tablespace_name[FN_LEN + 1];
if (get_tablespace_name(current_thd, tablespace_name, FN_LEN))
{
if (create_info->tablespace)