Fix for bug #4815 (embedded server calculates wrong places for outfiles)
In some places in mysqld behaviour depends on system working directory It works badly in libmysqld because user can set it in the way he needs. I think we should explicitly insert mysql_real_data_home value in paths in these places sql/sql_class.cc: here we concat mysql_real_data_home and thd->db to be the prefix sql/sql_load.cc: it's better to build the prefix from mysql_real_data_home also i think it's better always to call my_load_path to not to depend of current system working directory
This commit is contained in:
parent
68a1e80df4
commit
9d3009eaea
@ -854,12 +854,21 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
|
||||
{
|
||||
File file;
|
||||
uint option= MY_UNPACK_FILENAME;
|
||||
char buff[FN_REFLEN];
|
||||
|
||||
#ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS
|
||||
option|= MY_REPLACE_DIR; // Force use of db directory
|
||||
#endif
|
||||
(void) fn_format(path, exchange->file_name, thd->db ? thd->db : "", "",
|
||||
option);
|
||||
|
||||
char *cnt= strmake(buff, mysql_real_data_home, FN_REFLEN);
|
||||
*cnt= FN_LIBCHAR;
|
||||
cnt++;
|
||||
cnt= strmake(cnt, thd->db ? thd->db : "", FN_REFLEN - (cnt-buff));
|
||||
*cnt= FN_LIBCHAR;
|
||||
cnt++;
|
||||
*cnt= 0;
|
||||
|
||||
(void) fn_format(path, exchange->file_name, buff, "", option);
|
||||
if (!access(path, F_OK))
|
||||
{
|
||||
my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name);
|
||||
|
@ -180,7 +180,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
ex->file_name+=dirname_length(ex->file_name);
|
||||
#endif
|
||||
if (!dirname_length(ex->file_name) &&
|
||||
strlen(ex->file_name)+strlen(mysql_data_home)+strlen(tdb)+3 <
|
||||
strlen(ex->file_name)+strlen(mysql_real_data_home)+strlen(tdb)+3 <
|
||||
FN_REFLEN)
|
||||
{
|
||||
(void) sprintf(name,"%s/%s/%s",mysql_data_home,tdb,ex->file_name);
|
||||
@ -188,18 +188,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
char *chk_name= ex->file_name;
|
||||
while ((*chk_name == ' ') || (*chk_name == 't'))
|
||||
chk_name++;
|
||||
if (*chk_name == FN_CURLIB)
|
||||
{
|
||||
sprintf(name, "%s%s", mysql_data_home, ex->file_name);
|
||||
unpack_filename(name, name);
|
||||
}
|
||||
else
|
||||
#endif /*EMBEDDED_LIBRARY*/
|
||||
unpack_filename(name,ex->file_name);
|
||||
my_load_path(name, ex->file_name, mysql_real_data_home);
|
||||
unpack_filename(name, name);
|
||||
#if !defined(__WIN__) && !defined(OS2) && ! defined(__NETWARE__)
|
||||
MY_STAT stat_info;
|
||||
if (!my_stat(name,&stat_info,MYF(MY_WME)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user