summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorSujatha Sivakumar <sujatha.sivakumar@oracle.com>2012-07-10 14:23:17 +0530
committerSujatha Sivakumar <sujatha.sivakumar@oracle.com>2012-07-10 14:23:17 +0530
commitcf858b71ce0cc18909983d7f928a6961a580d77b (patch)
tree463203aac8d1044a95bb635e6ea52b0383a32905 /client
parentfcc53fa77cc514a9bd5b07adf905c583bb063f4b (diff)
downloadmariadb-git-cf858b71ce0cc18909983d7f928a6961a580d77b.tar.gz
BUG#11762670:MY_B_WRITE RETURN VALUE IGNORED
Problem: ======= The return value from my_b_write is ignored by: `my_b_write_quoted', `my_b_write_bit',`Query_log_event::print_query_header' Most callers of `my_b_printf' ignore the return value. `log_event.cc' has many calls to it. Analysis: ======== `my_b_write' is used to write data into a file. If the write fails it sets appropriate error number and error message through my_error() function call and sets the IO_CACHE::error == -1. `my_b_printf' function is also used to write data into a file, it internally invokes my_b_write to do the write operation. Upon success it returns number of characters written to file and on error it returns -1 and sets the error through my_error() and also sets IO_CACHE::error == -1. Most of the event specific print functions for example `Create_file_log_event::print', `Execute_load_log_event::print' etc are the ones which make several calls to the above two functions and they do not check for the return value after the 'print' call. All the above mentioned abuse cases deal with the client side. Fix: === As part of bug fix a check for IO_CACHE::error == -1 has been added at a very high level after the call to the 'print' function. There are few more places where the return value of "my_b_write" is ignored those are mentioned below. +++ mysys/mf_iocache2.c 2012-06-04 07:03:15 +0000 @@ -430,7 +430,8 @@ memset(buffz, '0', minimum_width - length2); else memset(buffz, ' ', minimum_width - length2); - my_b_write(info, buffz, minimum_width - length2); +++ sql/log.cc 2012-06-08 09:04:46 +0000 @@ -2388,7 +2388,12 @@ { end= strxmov(buff, "# administrator command: ", NullS); buff_len= (ulong) (end - buff); - my_b_write(&log_file, (uchar*) buff, buff_len); At these places appropriate return value handlers have been added.
Diffstat (limited to 'client')
-rw-r--r--client/mysqlbinlog.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index e7840865a58..b5acfc5c169 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -784,8 +784,11 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
goto end;
}
else
+ {
ce->print(result_file, print_event_info, TRUE);
-
+ if (head->error == -1)
+ goto err;
+ }
// If this binlog is not 3.23 ; why this test??
if (glob_description_event->binlog_version >= 3)
{
@@ -836,6 +839,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
ce->print(result_file, print_event_info, TRUE);
my_free((char*)ce->fname,MYF(MY_WME));
delete ce;
+ if (head->error == -1)
+ goto err;
}
else
warning("Ignoring Execute_load_log_event as there is no "
@@ -890,6 +895,12 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
{
convert_path_to_forward_slashes(fname);
exlq->print(result_file, print_event_info, fname);
+ if (head->error == -1)
+ {
+ if (fname)
+ my_free(fname, MYF(MY_WME));
+ goto err;
+ }
}
else
warning("Ignoring Execute_load_query since there is no "