Commit 4629ae29 authored by hf@deer.(none)'s avatar hf@deer.(none)

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
parent 56c807b2
......@@ -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)))
......
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