|
|
|
@ -460,8 +460,7 @@ static ssize_t sst_prepare_other (const char* method, |
|
|
|
const char* addr_in, |
|
|
|
const char** addr_out) |
|
|
|
{ |
|
|
|
ssize_t cmd_len= 1024; |
|
|
|
char cmd_str[cmd_len]; |
|
|
|
char cmd_str[1024]; |
|
|
|
const char* sst_dir= mysql_real_data_home; |
|
|
|
const char* binlog_opt= ""; |
|
|
|
char* binlog_opt_val= NULL; |
|
|
|
@ -477,7 +476,7 @@ static ssize_t sst_prepare_other (const char* method, |
|
|
|
|
|
|
|
make_wsrep_defaults_file(); |
|
|
|
|
|
|
|
ret= snprintf (cmd_str, cmd_len, |
|
|
|
ret= snprintf (cmd_str, sizeof(cmd_str), |
|
|
|
"wsrep_sst_%s " |
|
|
|
WSREP_SST_OPT_ROLE" 'joiner' " |
|
|
|
WSREP_SST_OPT_ADDR" '%s' " |
|
|
|
@ -491,7 +490,7 @@ static ssize_t sst_prepare_other (const char* method, |
|
|
|
binlog_opt, binlog_opt_val); |
|
|
|
my_free(binlog_opt_val); |
|
|
|
|
|
|
|
if (ret < 0 || ret >= cmd_len) |
|
|
|
if (ret < 0 || ret >= (int)sizeof(cmd_str)) |
|
|
|
{ |
|
|
|
WSREP_ERROR("sst_prepare_other(): snprintf() failed: %d", ret); |
|
|
|
return (ret < 0 ? ret : -EMSGSIZE); |
|
|
|
@ -742,7 +741,7 @@ static int sst_donate_mysqldump (const char* addr, |
|
|
|
host_len = strlen (addr) + 1; |
|
|
|
} |
|
|
|
|
|
|
|
char host[host_len]; |
|
|
|
char *host=(char*)alloca(host_len); |
|
|
|
|
|
|
|
strncpy (host, addr, host_len - 1); |
|
|
|
host[host_len - 1] = '\0'; |
|
|
|
@ -762,7 +761,7 @@ static int sst_donate_mysqldump (const char* addr, |
|
|
|
user_len = (auth) ? strlen (auth) + 1 : 1; |
|
|
|
} |
|
|
|
|
|
|
|
char user[user_len]; |
|
|
|
char *user=(char*)alloca(user_len); |
|
|
|
|
|
|
|
strncpy (user, (auth) ? auth : "", user_len - 1); |
|
|
|
user[user_len - 1] = '\0'; |
|
|
|
@ -770,14 +769,13 @@ static int sst_donate_mysqldump (const char* addr, |
|
|
|
int ret = sst_mysqldump_check_addr (user, pswd, host, port); |
|
|
|
if (!ret) |
|
|
|
{ |
|
|
|
size_t cmd_len= 1024; |
|
|
|
char cmd_str[cmd_len]; |
|
|
|
char cmd_str[1024]; |
|
|
|
|
|
|
|
if (!bypass && wsrep_sst_donor_rejects_queries) sst_reject_queries(TRUE); |
|
|
|
|
|
|
|
make_wsrep_defaults_file(); |
|
|
|
|
|
|
|
snprintf (cmd_str, cmd_len, |
|
|
|
snprintf (cmd_str, sizeof(cmd_str), |
|
|
|
"wsrep_sst_mysqldump " |
|
|
|
WSREP_SST_OPT_USER" '%s' " |
|
|
|
WSREP_SST_OPT_PSWD" '%s' " |
|
|
|
@ -874,9 +872,9 @@ static int sst_flush_tables(THD* thd) |
|
|
|
WSREP_INFO("Tables flushed."); |
|
|
|
const char base_name[]= "tables_flushed"; |
|
|
|
ssize_t const full_len= strlen(mysql_real_data_home) + strlen(base_name)+2; |
|
|
|
char real_name[full_len]; |
|
|
|
char *real_name=(char*)alloca(full_len); |
|
|
|
sprintf(real_name, "%s/%s", mysql_real_data_home, base_name); |
|
|
|
char tmp_name[full_len + 4]; |
|
|
|
char *tmp_name=(char*)alloca(full_len + 4); |
|
|
|
sprintf(tmp_name, "%s.tmp", real_name); |
|
|
|
|
|
|
|
FILE* file= fopen(tmp_name, "w+"); |
|
|
|
@ -1037,8 +1035,7 @@ static int sst_donate_other (const char* method, |
|
|
|
wsrep_seqno_t seqno, |
|
|
|
bool bypass) |
|
|
|
{ |
|
|
|
ssize_t cmd_len = 4096; |
|
|
|
char cmd_str[cmd_len]; |
|
|
|
char cmd_str[4096]; |
|
|
|
const char* binlog_opt= ""; |
|
|
|
char* binlog_opt_val= NULL; |
|
|
|
|
|
|
|
@ -1052,7 +1049,7 @@ static int sst_donate_other (const char* method, |
|
|
|
|
|
|
|
make_wsrep_defaults_file(); |
|
|
|
|
|
|
|
ret= snprintf (cmd_str, cmd_len, |
|
|
|
ret= snprintf (cmd_str, sizeof(cmd_str), |
|
|
|
"wsrep_sst_%s " |
|
|
|
WSREP_SST_OPT_ROLE" 'donor' " |
|
|
|
WSREP_SST_OPT_ADDR" '%s' " |
|
|
|
@ -1070,7 +1067,7 @@ static int sst_donate_other (const char* method, |
|
|
|
bypass ? " "WSREP_SST_OPT_BYPASS : ""); |
|
|
|
my_free(binlog_opt_val); |
|
|
|
|
|
|
|
if (ret < 0 || ret >= cmd_len) |
|
|
|
if (ret < 0 || ret >= (int)sizeof(cmd_str)) |
|
|
|
{ |
|
|
|
WSREP_ERROR("sst_donate_other(): snprintf() failed: %d", ret); |
|
|
|
return (ret < 0 ? ret : -EMSGSIZE); |
|
|
|
|