diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2018-07-02 15:29:22 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2018-07-02 15:29:22 +0300 |
commit | 1d10c9afe0f2f4fba73892e6c12ea6efe90d5931 (patch) | |
tree | 40142f3f9631fb528f4612f68cdb0f6ce8296eab /sql/wsrep_binlog.cc | |
parent | 36ea82617c1506532e863cb241296acc8b657243 (diff) | |
download | mariadb-git-1d10c9afe0f2f4fba73892e6c12ea6efe90d5931.tar.gz |
Post-fix to "Adopt Debian's fix-FTBFS-on-GNU-Hurd.patch", part #2.
"my_snprintf(NULL, 0, ...)" does not follow what snprintf does. Change
the call in wsrep_dump_rbr_buf_with_header to use snprintf (note that
wsrep_dump_rbr_buf was using snprintf all the way).
Fix an off-by-one error in comparison so it actually prints the output
Diffstat (limited to 'sql/wsrep_binlog.cc')
-rw-r--r-- | sql/wsrep_binlog.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc index f8553d015aa..902190d4772 100644 --- a/sql/wsrep_binlog.cc +++ b/sql/wsrep_binlog.cc @@ -327,11 +327,11 @@ void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len) return; } - char *filename= (char *)malloc(len++); + char *filename= (char *)malloc(len+1); int len1= snprintf(filename, len, "%s/GRA_%ld_%lld.log", wsrep_data_home_dir, thd->thread_id, (long long)wsrep_thd_trx_seqno(thd)); - if (len >= len1) + if (len > len1) { WSREP_ERROR("RBR dump path truncated: %d, skipping dump.", len); free(filename); @@ -466,22 +466,22 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf, longlong thd_trx_seqno= (long long)wsrep_thd_trx_seqno(thd); - int len= my_snprintf(NULL, 0, "%s/GRA_%ld_%lld_v2.log", - wsrep_data_home_dir, thd->thread_id, - thd_trx_seqno); + int len= snprintf(NULL, 0, "%s/GRA_%ld_%lld_v2.log", + wsrep_data_home_dir, thd->thread_id, + thd_trx_seqno); char *filename; - if (len < 0 || !(filename= (char*)malloc(len++))) + if (len < 0 || !(filename= (char*)malloc(len+1))) { WSREP_ERROR("snprintf error: %d, skipping dump.", len); DBUG_VOID_RETURN; } - int len1= my_snprintf(filename, len, "%s/GRA_%ld_%lld_v2.log", - wsrep_data_home_dir, thd->thread_id, - thd_trx_seqno); + int len1= snprintf(filename, len, "%s/GRA_%ld_%lld_v2.log", + wsrep_data_home_dir, thd->thread_id, + thd_trx_seqno); - if (len >= len1) + if (len > len1) { WSREP_ERROR("RBR dump path truncated: %d, skipping dump.", len); free(filename); |