diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-04-17 19:42:34 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-04-17 19:42:34 +0200 |
commit | 07315d36030bd1cbe6acfeb3e8f60c49ba876a10 (patch) | |
tree | 9c74de4bb97507ece945576df7073a7a28f07674 /sql/rpl_rli.cc | |
parent | 4656060f118caba30912cca2557d72fcea307283 (diff) | |
download | mariadb-git-07315d36030bd1cbe6acfeb3e8f60c49ba876a10.tar.gz |
strmake_buf(X,Y) helper, equivalent to strmake(X,Y,sizeof(X)-1)
with a bit of lame protection against abuse.
Diffstat (limited to 'sql/rpl_rli.cc')
-rw-r--r-- | sql/rpl_rli.cc | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index cbd7ac8f5ef..e03d46606d5 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -309,8 +309,7 @@ Failed to open the existing relay log info file '%s' (errno %d)", msg="Error reading slave log configuration"; goto err; } - strmake(rli->event_relay_log_name,rli->group_relay_log_name, - sizeof(rli->event_relay_log_name)-1); + strmake_buf(rli->event_relay_log_name,rli->group_relay_log_name); rli->group_relay_log_pos= rli->event_relay_log_pos= relay_log_pos; rli->group_master_log_pos= master_log_pos; @@ -528,10 +527,8 @@ int init_relay_log_pos(Relay_log_info* rli,const char* log, *errmsg="Could not find target log during relay log initialization"; goto err; } - strmake(rli->group_relay_log_name,rli->linfo.log_file_name, - sizeof(rli->group_relay_log_name)-1); - strmake(rli->event_relay_log_name,rli->linfo.log_file_name, - sizeof(rli->event_relay_log_name)-1); + strmake_buf(rli->group_relay_log_name,rli->linfo.log_file_name); + strmake_buf(rli->event_relay_log_name,rli->linfo.log_file_name); if (rli->relay_log.is_active(rli->linfo.log_file_name)) { /* @@ -871,8 +868,7 @@ void Relay_log_info::inc_group_relay_log_pos(ulonglong log_pos, mysql_mutex_lock(&data_lock); inc_event_relay_log_pos(); group_relay_log_pos= event_relay_log_pos; - strmake(group_relay_log_name,event_relay_log_name, - sizeof(group_relay_log_name)-1); + strmake_buf(group_relay_log_name,event_relay_log_name); notify_group_relay_log_name_update(); @@ -1005,10 +1001,8 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset, goto err; } /* Save name of used relay log file */ - strmake(rli->group_relay_log_name, rli->relay_log.get_log_fname(), - sizeof(rli->group_relay_log_name)-1); - strmake(rli->event_relay_log_name, rli->relay_log.get_log_fname(), - sizeof(rli->event_relay_log_name)-1); + strmake_buf(rli->group_relay_log_name, rli->relay_log.get_log_fname()); + strmake_buf(rli->event_relay_log_name, rli->relay_log.get_log_fname()); rli->group_relay_log_pos= rli->event_relay_log_pos= BIN_LOG_HEADER_SIZE; if (count_relay_log_space(rli)) { |