mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
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' )
This commit is contained in:
@ -378,9 +378,9 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
|
||||
char path[FN_REFLEN+16];
|
||||
long result= 1;
|
||||
int error= 0;
|
||||
uint length;
|
||||
MY_STAT stat_info;
|
||||
uint create_options= create_info ? create_info->options : 0;
|
||||
uint path_len;
|
||||
DBUG_ENTER("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,
|
||||
|
||||
/* Check directory */
|
||||
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)))
|
||||
{
|
||||
@ -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);
|
||||
goto exit;
|
||||
}
|
||||
strend(path)[-1]=0; // Remove last '/' from path
|
||||
if (my_mkdir(path,0777,MYF(0)) < 0)
|
||||
{
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
length= unpack_dirname(path, path);
|
||||
strmov(path+ length, MY_DB_OPT_FILE);
|
||||
path[path_len-1]= FN_LIBCHAR;
|
||||
strmake(path+path_len, MY_DB_OPT_FILE, sizeof(path)-path_len-1);
|
||||
if (write_db_opt(thd, path, create_info))
|
||||
{
|
||||
/*
|
||||
Could not create options file.
|
||||
Restore things to beginning.
|
||||
*/
|
||||
path[length]= 0;
|
||||
path[path_len]= 0;
|
||||
if (rmdir(path) >= 0)
|
||||
{
|
||||
error= -1;
|
||||
|
Reference in New Issue
Block a user