summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/encryption/t/tempfiles.combinations5
-rw-r--r--mysys/mf_iocache.c2
-rw-r--r--sql/mf_iocache_encr.cc5
3 files changed, 9 insertions, 3 deletions
diff --git a/mysql-test/suite/encryption/t/tempfiles.combinations b/mysql-test/suite/encryption/t/tempfiles.combinations
new file mode 100644
index 00000000000..7010d2c100d
--- /dev/null
+++ b/mysql-test/suite/encryption/t/tempfiles.combinations
@@ -0,0 +1,5 @@
+[none]
+binlog-checksum=NONE
+
+[crc32]
+binlog-checksum=CRC32
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index a0ddc3e40a5..56b1ae3fc6e 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -440,7 +440,7 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
info->read_end= info->buffer;
_my_b_encr_read(info, 0, 0); /* prefill the buffer */
info->write_pos= info->read_pos;
- info->pos_in_file+= info->buffer_length;
+ info->seek_not_done=1;
}
}
else
diff --git a/sql/mf_iocache_encr.cc b/sql/mf_iocache_encr.cc
index ae314d826a0..149e6feb605 100644
--- a/sql/mf_iocache_encr.cc
+++ b/sql/mf_iocache_encr.cc
@@ -145,9 +145,10 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
if (info->seek_not_done)
{
- DBUG_ASSERT(info->pos_in_file == 0);
+ DBUG_ASSERT(info->pos_in_file % info->buffer_length == 0);
+ size_t wpos= info->pos_in_file / info->buffer_length * crypt_data->block_length;
- if ((mysql_file_seek(info->file, 0, MY_SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR))
+ if ((mysql_file_seek(info->file, wpos, MY_SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR))
{
info->error= -1;
DBUG_RETURN(1);