summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <cmiller@zippy.cornsilk.net>2006-08-23 10:47:46 -0400
committerunknown <cmiller@zippy.cornsilk.net>2006-08-23 10:47:46 -0400
commit029af2b126a629cc7fe231df5eb336e806e841e1 (patch)
treef57a4c2f4cf7cd15d1348a9667df688630a0e9fb /client
parentf40b6c273cb782bd3fd4563518eb5d57c010f13d (diff)
parentbb2bc56f28293d55917879e9e9a1edea62107803 (diff)
downloadmariadb-git-029af2b126a629cc7fe231df5eb336e806e841e1.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into zippy.cornsilk.net:/home/cmiller/work/mysql/m50-maint-b21224 client/mysql_upgrade.c: Auto merged
Diffstat (limited to 'client')
-rw-r--r--client/mysql_upgrade.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index c68f8777624..9a73263f558 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -157,17 +157,29 @@ static int create_defaults_file(const char *path, const char *our_defaults_path)
File our_defaults_file, defaults_file;
char buffer[512];
char *buffer_end;
+ int failed_to_open_count= 0;
int error;
/* check if the defaults file is needed at all */
if (!opt_password)
return 0;
- defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY,
+retry_open:
+ defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY | O_EXCL,
MYF(MY_FAE | MY_WME));
if (defaults_file < 0)
- return 1;
+ {
+ if (failed_to_open_count == 0)
+ {
+ remove(path);
+ failed_to_open_count+= 1;
+ goto retry_open;
+ }
+ else
+ return 1;
+ }
+
upgrade_defaults_created= 1;
if (our_defaults_path)
{