diff options
author | <Dao-Gang.Qu@sun.com> | 2009-11-05 14:07:31 +0800 |
---|---|---|
committer | <Dao-Gang.Qu@sun.com> | 2009-11-05 14:07:31 +0800 |
commit | 8d52424326f9fea4e616c8aad5edbe632dbbdf63 (patch) | |
tree | bfa6953f6e5f3ba921a4f60aeb55f6f7c9ee4e7b /sql/rpl_rli.cc | |
parent | 2b87e80ab3010b383672f68f0796b9dc6795bdf6 (diff) | |
download | mariadb-git-8d52424326f9fea4e616c8aad5edbe632dbbdf63.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.
Diffstat (limited to 'sql/rpl_rli.cc')
-rw-r--r-- | sql/rpl_rli.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 0c6cc15297f..a9ed736b453 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -132,6 +132,29 @@ int init_relay_log_info(Relay_log_info* rli, rli->relay_log.max_size (and mysql_bin_log.max_size). */ { + /* Reports an error and returns, if the --relay-log's path + is a directory.*/ + if (opt_relay_logname && + opt_relay_logname[strlen(opt_relay_logname) - 1] == FN_LIBCHAR) + { + pthread_mutex_unlock(&rli->data_lock); + sql_print_error("Path '%s' is a directory name, please specify \ +a file name for --relay-log option", opt_relay_logname); + DBUG_RETURN(1); + } + + /* Reports an error and returns, if the --relay-log-index's path + is a directory.*/ + if (opt_relaylog_index_name && + opt_relaylog_index_name[strlen(opt_relaylog_index_name) - 1] + == FN_LIBCHAR) + { + pthread_mutex_unlock(&rli->data_lock); + sql_print_error("Path '%s' is a directory name, please specify \ +a file name for --relay-log-index option", opt_relaylog_index_name); + DBUG_RETURN(1); + } + char buf[FN_REFLEN]; const char *ln; static bool name_warning_sent= 0; |