summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorunknown <Dao-Gang.Qu@sun.com>2009-11-05 14:07:31 +0800
committerunknown <Dao-Gang.Qu@sun.com>2009-11-05 14:07:31 +0800
commitb958fc655f85025d7dd6c2b8923ba8fd74652f67 (patch)
treebfa6953f6e5f3ba921a4f60aeb55f6f7c9ee4e7b /sql/mysqld.cc
parenteb03f819f1f1d40b97f51d9345cbaa0bc6cbd801 (diff)
downloadmariadb-git-b958fc655f85025d7dd6c2b8923ba8fd74652f67.tar.gz
Bug #34739 unexpected binlog file name when --log-bin is set to a directory name
If --log-bin is set to a directory name with the trailing 'FN_LIBCHAR', which will be '/' on Unix like systems, and '\\' on Windows like systems. the basename of the binlog is empty so that the created files named '.000001' and '.index'. It is not expected. The same thing happened to --log-bin-index, --relay-log and --relay-log-index options. To resolve the problem, in these cases the program should report an error and abort. sql/mysqld.cc: Added a check for the value of the --log-bin and --log-bin-index arguments, if it's a directory, reports an error and aborts. sql/rpl_rli.cc: Added a check for the value of the --relay-log and --relay-log-index arguments, if it's a directory, reports an error and aborts.
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 1da51338517..2be95bca54d 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3888,6 +3888,27 @@ server.");
if (opt_bin_log)
{
+ /* Reports an error and aborts, if the --log-bin's path
+ is a directory.*/
+ if (opt_bin_logname &&
+ opt_bin_logname[strlen(opt_bin_logname) - 1] == FN_LIBCHAR)
+ {
+ sql_print_error("Path '%s' is a directory name, please specify \
+a file name for --log-bin option", opt_bin_logname);
+ unireg_abort(1);
+ }
+
+ /* Reports an error and aborts, if the --log-bin-index's path
+ is a directory.*/
+ if (opt_binlog_index_name &&
+ opt_binlog_index_name[strlen(opt_binlog_index_name) - 1]
+ == FN_LIBCHAR)
+ {
+ sql_print_error("Path '%s' is a directory name, please specify \
+a file name for --log-bin-index option", opt_binlog_index_name);
+ unireg_abort(1);
+ }
+
char buf[FN_REFLEN];
const char *ln;
ln= mysql_bin_log.generate_name(opt_bin_logname, "-bin", 1, buf);