summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2004-08-24 22:45:32 +0500
committerunknown <hf@deer.(none)>2004-08-24 22:45:32 +0500
commit9d3009eaeab17e3695f7d7184089714ebd95bd20 (patch)
tree52407c91656a64132402a5ce4a46facc3f3114a9 /sql/sql_class.cc
parent68a1e80df46b06befd9e899e9ac24d3b49b16897 (diff)
downloadmariadb-git-9d3009eaeab17e3695f7d7184089714ebd95bd20.tar.gz
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
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index aecb2ef6522..80b9d6e20bf 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -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);