Commit 1d21b221 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-10001 my_b_seek() may not work correctly after my_b_read() hits EOF

applied the patch from  David Gow
parent ecdf46da
...@@ -507,6 +507,7 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count) ...@@ -507,6 +507,7 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
{ {
/* End of file. Return, what we did copy from the buffer. */ /* End of file. Return, what we did copy from the buffer. */
info->error= (int) left_length; info->error= (int) left_length;
info->seek_not_done=1;
DBUG_RETURN(1); DBUG_RETURN(1);
} }
/* /*
...@@ -524,6 +525,7 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count) ...@@ -524,6 +525,7 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
*/ */
info->error= (read_length == (size_t) -1 ? -1 : info->error= (read_length == (size_t) -1 ? -1 :
(int) (read_length+left_length)); (int) (read_length+left_length));
info->seek_not_done=1;
DBUG_RETURN(1); DBUG_RETURN(1);
} }
Count-=length; Count-=length;
...@@ -572,6 +574,7 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count) ...@@ -572,6 +574,7 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
/* For a read error, return -1, otherwise, what we got in total. */ /* For a read error, return -1, otherwise, what we got in total. */
info->error= length == (size_t) -1 ? -1 : (int) (length+left_length); info->error= length == (size_t) -1 ? -1 : (int) (length+left_length);
info->read_pos=info->read_end=info->buffer; info->read_pos=info->read_end=info->buffer;
info->seek_not_done=1;
DBUG_RETURN(1); DBUG_RETURN(1);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment