summaryrefslogtreecommitdiff
path: root/client/mysql_upgrade.c
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2010-03-09 11:18:46 +0200
committerGeorgi Kodinov <joro@sun.com>2010-03-09 11:18:46 +0200
commit25a271a0f84e1ea32c46da090c2d0bde77fadbbc (patch)
tree5f0f9f09bbe8ed615ca03103c83c2cd3c5dbd606 /client/mysql_upgrade.c
parentd5991c13bdb1750dfea539c05081d921437fb2b9 (diff)
downloadmariadb-git-25a271a0f84e1ea32c46da090c2d0bde77fadbbc.tar.gz
Bug #41057: mysql_update fails FATAL ERROR: Failed to create temporary file for defaults
mysql_upgrade was passing an non-initialized non-null tmpdir to create_temp_file() if no --tmpdir was specified. This prevents create_temp_file() from taking the system temporary file path and as a result mysql_upgrade was trying to open a file in a directory that it may not have write access to. Fixed by making sure mysql_upgrade will pass a zero length temp dir string to create_temp_file() if no --tmpdir is specified.
Diffstat (limited to 'client/mysql_upgrade.c')
-rw-r--r--client/mysql_upgrade.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 689a2c82571..ade8e30648a 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -44,7 +44,7 @@ static DYNAMIC_STRING conn_args;
static char *opt_password= 0;
static my_bool tty_password= 0;
-static char opt_tmpdir[FN_REFLEN];
+static char opt_tmpdir[FN_REFLEN] = "";
#ifndef DBUG_OFF
static char *default_dbug_option= (char*) "d:t:O,/tmp/mysql_upgrade.trace";
@@ -459,7 +459,8 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
DBUG_ENTER("run_query");
DBUG_PRINT("enter", ("query: %s", query));
- if ((fd= create_temp_file(query_file_path, opt_tmpdir,
+ if ((fd= create_temp_file(query_file_path,
+ opt_tmpdir[0] ? opt_tmpdir : NULL,
"sql", O_CREAT | O_SHARE | O_RDWR,
MYF(MY_WME))) < 0)
die("Failed to create temporary file for defaults");