summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/my_sys.h2
-rw-r--r--mysys/mf_iocache.c14
-rw-r--r--sql/log.cc2
-rw-r--r--sql/log_event.cc16
4 files changed, 18 insertions, 16 deletions
diff --git a/include/my_sys.h b/include/my_sys.h
index 7f8b8a80a1c..9f4b91c8bf6 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -677,6 +677,8 @@ extern int _my_b_get(IO_CACHE *info);
extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count);
extern int _my_b_write(IO_CACHE *info,const byte *Buffer,uint Count);
extern int my_b_append(IO_CACHE *info,const byte *Buffer,uint Count);
+extern int my_b_safe_write(IO_CACHE *info,const byte *Buffer,uint Count);
+
extern int my_block_write(IO_CACHE *info, const byte *Buffer,
uint Count, my_off_t pos);
extern int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock);
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index 0f35ee048bb..d96d4c0db3c 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -988,6 +988,20 @@ end:
}
+int my_b_safe_write(IO_CACHE *info, const byte *Buffer, uint Count)
+{
+ /*
+ Sasha: We are not writing this with the ? operator to avoid hitting
+ a possible compiler bug. At least gcc 2.95 cannot deal with
+ several layers of ternary operators that evaluated comma(,) operator
+ expressions inside - I do have a test case if somebody wants it
+ */
+ if (info->type == SEQ_READ_APPEND)
+ return my_b_append(info, Buffer, Count);
+ return my_b_write(info, Buffer, Count);
+}
+
+
/*
Write a block to disk where part of the data may be inside the record
buffer. As all write calls to the data goes through the cache,
diff --git a/sql/log.cc b/sql/log.cc
index 17715620950..4dce26d23ea 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -263,7 +263,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
an extension for the binary log files.
In this case we write a standard header to it.
*/
- if (my_b_write(&log_file, (byte*) BINLOG_MAGIC, BIN_LOG_HEADER_SIZE))
+ if (my_b_safe_write(&log_file, (byte*) BINLOG_MAGIC, BIN_LOG_HEADER_SIZE))
goto err;
bytes_written += BIN_LOG_HEADER_SIZE;
write_file_name_to_index_file=1;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 591ebf2b5d8..2a1669737f8 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -26,20 +26,6 @@
#include <assert.h>
-inline int my_b_safe_write(IO_CACHE* file, const byte *buf,
- int len)
-{
- /*
- Sasha: We are not writing this with the ? operator to avoid hitting
- a possible compiler bug. At least gcc 2.95 cannot deal with
- several layers of ternary operators that evaluated comma(,) operator
- expressions inside - I do have a test case if somebody wants it
- */
- if (file->type == SEQ_READ_APPEND)
- return my_b_append(file, buf,len);
- return my_b_write(file, buf,len);
-}
-
#ifdef MYSQL_CLIENT
static void pretty_print_str(FILE* file, char* str, int len)
{
@@ -2039,7 +2025,7 @@ Slave: load data infile on table '%s' at log position %s in log \
err=ER(sql_errno);
}
slave_print_error(rli,sql_errno,"\
-Error '%s' running lOAD DATA INFILE on table '%s'. Default database: '%s'",
+Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
err, (char*)table_name, print_slave_db_safe(db));
free_root(&thd->mem_root,0);
return 1;