diff options
author | unknown <sasha@mysql.sashanet.com> | 2000-10-05 17:58:16 -0600 |
---|---|---|
committer | unknown <sasha@mysql.sashanet.com> | 2000-10-05 17:58:16 -0600 |
commit | 7e52afcd93f4113cf1a7d47e0d15fde6b3b06485 (patch) | |
tree | 94e00d7d13ba2935c9774b36bdfa820e0898f713 /sql/mysqlbinlog.cc | |
parent | 295c3d1fa9a1950d1ebf6832da896e36f483d692 (diff) | |
download | mariadb-git-7e52afcd93f4113cf1a7d47e0d15fde6b3b06485.tar.gz |
sql/log.cc
Added magic number to binlog
sql/log_event.cc
distinquish bogus data from truncated logs
sql/log_event.h
added magic number
added LOG_READ_TRUNC error
sql/mysqlbinlog.cc
fixed to handle magic number
added O_BINARY to my_fopen
sql/mysqld.cc
added code for replicate-rewrite-db
sql/slave.cc
replicate-rewrite-db
O_BINARY
handle magic
sql/sql_class.h
added i_string_pair class
sql/sql_repl.cc
added magic
better error messages
support-files/magic
added magic for binlog
Added test case for replication of queries with error
sql/log.cc:
Added magic number to binlog
sql/log_event.cc:
distinquish bogus data from truncated logs
sql/log_event.h:
added magic number
added LOG_READ_TRUNC error
sql/mysqlbinlog.cc:
fixed to handle magic number
added O_BINARY to my_fopen
sql/mysqld.cc:
added code for replicate-rewrite-db
sql/slave.cc:
replicate-rewrite-db
O_BINARY
handle magic
sql/sql_class.h:
added i_string_pair class
sql/sql_repl.cc:
added magic
better error messages
support-files/magic:
added magic for binlog
Diffstat (limited to 'sql/mysqlbinlog.cc')
-rw-r--r-- | sql/mysqlbinlog.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sql/mysqlbinlog.cc b/sql/mysqlbinlog.cc index bb115e250b5..505604ea7d4 100644 --- a/sql/mysqlbinlog.cc +++ b/sql/mysqlbinlog.cc @@ -267,6 +267,15 @@ static void dump_remote_log_entries(const char* logname) char buf[128]; uint len; NET* net = &mysql->net; + if(!position) position = 4; // protect the innocent from spam + if(position < 4) + { + position = 4; + // warn the guity + fprintf(stderr, + "Warning: with the position so small you would hit the magic number\n\ +Unfortunately, no sweepstakes today, adjusted position to 4\n"); + } int4store(buf, position); int2store(buf + 4, binlog_flags); len = (uint) strlen(logname); @@ -305,7 +314,7 @@ static void dump_local_log_entries(const char* logname) int rec_count = 0; if(logname && logname[0] != '-') - file = my_fopen(logname, O_RDONLY, MYF(MY_WME)); + file = my_fopen(logname, O_RDONLY|O_BINARY, MYF(MY_WME)); else file = stdin; @@ -314,6 +323,15 @@ static void dump_local_log_entries(const char* logname) if(my_fseek(file, position, MY_SEEK_SET, MYF(MY_WME))) die("failed on my_fseek()"); + + if(!position) + { + char magic[4]; + if(my_fread(file, magic, sizeof(magic), MYF(MY_NABP|MY_WME))) + die("I/O error reading binlog magic number"); + if(memcmp(magic, BINLOG_MAGIC, 4)) + die("Bad magic number"); + } while(1) { |