diff options
author | unknown <dlenev@mysql.com> | 2003-09-19 16:43:56 +0400 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2003-09-19 16:43:56 +0400 |
commit | 2a036dfa14bea2a10710b20491d1953397ca9e04 (patch) | |
tree | 92bbe60cf22751788a557ac46a876ca52a274191 /client | |
parent | 65cf37d3fb29560badceeb980a8d825b8253ed64 (diff) | |
download | mariadb-git-2a036dfa14bea2a10710b20491d1953397ca9e04.tar.gz |
Fix for bug #1340 (More careful checks if we met proper Create_file_log_event before Append or Exec event we are processing now)
client/mysqlbinlog.cc:
More accurate checks if Create_file_log_event is absent for this Append or Exec event...
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqlbinlog.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index ac43130b8bc..e00c60ef0a5 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -169,6 +169,8 @@ public: } Create_file_log_event *grab_event(uint file_id) { + if (file_id >= file_names.elements) + return 0; Create_file_log_event **ptr= (Create_file_log_event**)file_names.buffer + file_id; Create_file_log_event *res= *ptr; @@ -182,8 +184,14 @@ public: } void process(Append_block_log_event *ae) { - if (ae->file_id >= file_names.elements) - { + Create_file_log_event* ce= 0; + + if (ae->file_id < file_names.elements) + ce= *((Create_file_log_event**)file_names.buffer + ae->file_id); + + if (ce) + append_to_file(ce->fname,O_APPEND|O_BINARY|O_WRONLY,ae->block,ae->block_len); + else /* There is no Create_file event (a bad binlog or a big --position). Assuming it's a big --position, we just do nothing and @@ -191,11 +199,6 @@ public: */ fprintf(stderr,"Warning: ignoring Append_block as there is no \ Create_file event for file_id: %u\n",ae->file_id); - return; - } - Create_file_log_event* ce= - *((Create_file_log_event**)file_names.buffer + ae->file_id); - append_to_file(ce->fname,O_APPEND|O_BINARY|O_WRONLY,ae->block,ae->block_len); } }; |