Commit 34857ee6 authored by vva@eagle.mysql.r18.ru's avatar vva@eagle.mysql.r18.ru

manual merge

charged sql/sql_db.cc only
(
changed length in mysql_create_db to path_len
so as it was calculated in the first unpack_dirname
in my previous fix for Bug #4378
'"create database IF NOT EXISTS thing" returns an error'
)
parents 07808113 67829822
...@@ -378,9 +378,9 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, ...@@ -378,9 +378,9 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
char path[FN_REFLEN+16]; char path[FN_REFLEN+16];
long result= 1; long result= 1;
int error= 0; int error= 0;
uint length;
MY_STAT stat_info; MY_STAT stat_info;
uint create_options= create_info ? create_info->options : 0; uint create_options= create_info ? create_info->options : 0;
uint path_len;
DBUG_ENTER("mysql_create_db"); DBUG_ENTER("mysql_create_db");
VOID(pthread_mutex_lock(&LOCK_mysql_create_db)); VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
...@@ -394,7 +394,8 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, ...@@ -394,7 +394,8 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
/* Check directory */ /* Check directory */
strxmov(path, mysql_data_home, "/", db, NullS); strxmov(path, mysql_data_home, "/", db, NullS);
unpack_dirname(path,path); // Convert if not unix path_len= unpack_dirname(path,path); // Convert if not unix
path[path_len-1]= 0; // Remove last '/' from path
if (my_stat(path,&stat_info,MYF(0))) if (my_stat(path,&stat_info,MYF(0)))
{ {
...@@ -413,7 +414,6 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, ...@@ -413,7 +414,6 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
my_error(EE_STAT, MYF(0),path,my_errno); my_error(EE_STAT, MYF(0),path,my_errno);
goto exit; goto exit;
} }
strend(path)[-1]=0; // Remove last '/' from path
if (my_mkdir(path,0777,MYF(0)) < 0) if (my_mkdir(path,0777,MYF(0)) < 0)
{ {
my_error(ER_CANT_CREATE_DB,MYF(0),db,my_errno); my_error(ER_CANT_CREATE_DB,MYF(0),db,my_errno);
...@@ -422,15 +422,15 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, ...@@ -422,15 +422,15 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
} }
} }
length= unpack_dirname(path, path); path[path_len-1]= FN_LIBCHAR;
strmov(path+ length, MY_DB_OPT_FILE); strmake(path+path_len, MY_DB_OPT_FILE, sizeof(path)-path_len-1);
if (write_db_opt(thd, path, create_info)) if (write_db_opt(thd, path, create_info))
{ {
/* /*
Could not create options file. Could not create options file.
Restore things to beginning. Restore things to beginning.
*/ */
path[length]= 0; path[path_len]= 0;
if (rmdir(path) >= 0) if (rmdir(path) >= 0)
{ {
error= -1; error= -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment