summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-05-19 15:14:02 -0700
committerunknown <jimw@mysql.com>2005-05-19 15:14:02 -0700
commit496a3f20ad2a074ce0ccc238b8b40ba7cdbd9b87 (patch)
treec63fdf9cb17fd823ffbb7a1fc0314ec846068db4 /mysys
parent50c4ed93c1846419eef30863857c27eb68bd7630 (diff)
parentfb00361bae9eb780a0724966121d93d0ed2f9ab9 (diff)
downloadmariadb-git-496a3f20ad2a074ce0ccc238b8b40ba7cdbd9b87.tar.gz
Merge mysql.com:/home/jimw/my/mysql-5.0-8271
into mysql.com:/home/jimw/my/mysql-5.0-build
Diffstat (limited to 'mysys')
-rw-r--r--mysys/mf_iocache.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index b86e9daf92d..a55a2d81c2c 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -171,7 +171,7 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
info->arg = 0;
info->alloced_buffer = 0;
info->buffer=0;
- info->seek_not_done= test(file >= 0);
+ info->seek_not_done= test(file >= 0 && seek_offset != my_tell(file, MYF(0)));
info->disk_writes= 0;
#ifdef THREAD
info->share=0;
@@ -184,8 +184,10 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
{ /* Assume file isn't growing */
if (!(cache_myflags & MY_DONT_CHECK_FILESIZE))
{
- /* Calculate end of file to not allocate to big buffers */
+ /* Calculate end of file to avoid allocating oversized buffers */
end_of_file=my_seek(file,0L,MY_SEEK_END,MYF(0));
+ /* Need to reset seek_not_done now that we just did a seek. */
+ info->seek_not_done= end_of_file == seek_offset ? 0 : 1;
if (end_of_file < seek_offset)
end_of_file=seek_offset;
/* Trim cache size if the file is very small */