diff options
author | unknown <jimw@mysql.com> | 2005-05-19 17:43:17 -0700 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-05-19 17:43:17 -0700 |
commit | 3034935a875d959c21af79d08fbda2a1d32f11c6 (patch) | |
tree | b7d749360ecdf589e2ae819abf1525323991c3cd | |
parent | 4c3d3bb2f4f24c315ee5f203d626d018801a80ad (diff) | |
parent | 496a3f20ad2a074ce0ccc238b8b40ba7cdbd9b87 (diff) | |
download | mariadb-git-3034935a875d959c21af79d08fbda2a1d32f11c6.tar.gz |
Merge mysql.com:/home/jimw/my/mysql-5.0-build
into mysql.com:/home/jimw/my/mysql-5.0-clean
-rw-r--r-- | mysys/mf_iocache.c | 6 |
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 */ |