summaryrefslogtreecommitdiff
path: root/sql/ha_myisam.cc
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-03-10 11:22:37 +0200
committerunknown <monty@narttu.mysql.fi>2003-03-10 11:22:37 +0200
commit68ae365395c78eba74b4db66fb0989e76d221d0d (patch)
treecaaf93f4311641760c5a58ab8099d7eab15c0d79 /sql/ha_myisam.cc
parent374ea106f5098e4a6ee79f217bf799d181d20a25 (diff)
downloadmariadb-git-68ae365395c78eba74b4db66fb0989e76d221d0d.tar.gz
Don't allow BACKUP TABLE to overwrite files
Fixed memory leak when replication restarts in debug mode include/my_sys.h: Added option to not overwrite files to my_copy() mysql-test/mysql-test-run.sh: Fixed --ddd option Fixed that mysqld is restarted if there is a testname-master.sh file mysql-test/r/backup.result: Update for security fix in BACKUP TABLE mysql-test/t/backup.test: Update for security fix in BACKUP TABLE mysys/my_copy.c: Added option to not overwrite files to my_copy() sql/ha_myisam.cc: Don't allow BACKUP TABLE to overwrite files sql/slave.cc: Fixed problem with --debug output from 'handle_slave' Fixed memory leak when replication restarts in debug mode
Diffstat (limited to 'sql/ha_myisam.cc')
-rw-r--r--sql/ha_myisam.cc42
1 files changed, 21 insertions, 21 deletions
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 31a8d3c7109..1349e28b546 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -419,38 +419,38 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
const char* errmsg = "";
if (!fn_format(dst_path, table_name, backup_dir, reg_ext, 4 + 64))
- {
- errmsg = "Failed in fn_format() for .frm file: errno = %d";
- error = HA_ADMIN_INVALID;
- goto err;
- }
+ {
+ errmsg = "Failed in fn_format() for .frm file (errno: %d)";
+ error = HA_ADMIN_INVALID;
+ goto err;
+ }
if (my_copy(fn_format(src_path, table->path,"", reg_ext, 4),
- dst_path,
- MYF(MY_WME | MY_HOLD_ORIGINAL_MODES )))
+ dst_path,
+ MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE)))
{
error = HA_ADMIN_FAILED;
- errmsg = "Failed copying .frm file: errno = %d";
+ errmsg = "Failed copying .frm file (errno: %d)";
goto err;
}
if (!fn_format(dst_path, table_name, backup_dir, MI_NAME_DEXT, 4 + 64))
- {
- errmsg = "Failed in fn_format() for .MYD file: errno = %d";
- error = HA_ADMIN_INVALID;
- goto err;
- }
+ {
+ errmsg = "Failed in fn_format() for .MYD file (errno: %d)";
+ error = HA_ADMIN_INVALID;
+ goto err;
+ }
if (my_copy(fn_format(src_path, table->path,"", MI_NAME_DEXT, 4),
dst_path,
- MYF(MY_WME | MY_HOLD_ORIGINAL_MODES )) )
- {
- errmsg = "Failed copying .MYD file: errno = %d";
- error= HA_ADMIN_FAILED;
- goto err;
- }
+ MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE)))
+ {
+ errmsg = "Failed copying .MYD file (errno: %d)";
+ error= HA_ADMIN_FAILED;
+ goto err;
+ }
return HA_ADMIN_OK;
- err:
+err:
{
MI_CHECK param;
myisamchk_init(&param);
@@ -459,7 +459,7 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
param.db_name = table->table_cache_key;
param.table_name = table->table_name;
param.testflag = 0;
- mi_check_print_error(&param,errmsg, errno );
+ mi_check_print_error(&param, errmsg, my_errno);
return error;
}
}