diff options
author | Sergei Golubchik <sergii@pisem.net> | 2010-10-29 23:18:02 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2010-10-29 23:18:02 +0200 |
commit | 310584a849ea5912c23f3260ce0f2eff3128c566 (patch) | |
tree | 87a901f3ee2215cfd43a7f3dbce7f46017b43219 /client/mysqltest.cc | |
parent | 716f7843757f96649cca1f5dc3df5d9659b17da9 (diff) | |
parent | c6b19ea001965b350df1248c33f709127d2c7e47 (diff) | |
download | mariadb-git-310584a849ea5912c23f3260ce0f2eff3128c566.tar.gz |
merge w/ 5.1
Diffstat (limited to 'client/mysqltest.cc')
-rw-r--r-- | client/mysqltest.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 5162d58d02d..635d013eae8 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -610,14 +610,14 @@ public: lines++; int show_offset= 0; - char buf[256]; + char buf[256+1]; /* + zero termination for DBUG_PRINT */ size_t bytes; bool found_bof= false; /* Search backward in file until "lines" newline has been found */ while (lines && !found_bof) { - show_offset-= sizeof(buf); + show_offset-= sizeof(buf)-1; while(fseek(m_file, show_offset, SEEK_END) != 0 && show_offset < 0) { found_bof= true; @@ -625,7 +625,7 @@ public: show_offset++; } - if ((bytes= fread(buf, 1, sizeof(buf), m_file)) <= 0) + if ((bytes= fread(buf, 1, sizeof(buf)-1, m_file)) <= 0) { // ferror=0 will happen here if no queries executed yet if (ferror(m_file)) @@ -635,6 +635,7 @@ public: DBUG_VOID_RETURN; } + IF_DBUG(buf[bytes]= '\0';) DBUG_PRINT("info", ("Read %lu bytes from file, buf: %s", (unsigned long)bytes, buf)); @@ -679,8 +680,8 @@ public: } } - while ((bytes= fread(buf, 1, sizeof(buf), m_file)) > 0) - if (fwrite(buf, 1, bytes, stderr)) + while ((bytes= fread(buf, 1, sizeof(buf)-1, m_file)) > 0) + if (bytes != fwrite(buf, 1, bytes, stderr)) die("Failed to write to '%s', errno: %d", m_file_name, errno); @@ -723,6 +724,10 @@ void handle_no_error(struct st_command*); #ifdef EMBEDDED_LIBRARY +/* workaround for MySQL BUG#57491 */ +#undef MY_WME +#define MY_WME 0 + /* attributes of the query thread */ pthread_attr_t cn_thd_attrib; |