From b4c44f8eebad9056051a91d8afff7c6de704e752 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 14 Apr 2014 11:17:52 -0500 Subject: [svn-r25045] Fixed a few missing lines of code that were not merged when the core VFD paging changes were brought over. Tested on: 32-bit LE linux (jam) 64-bit LE linux (koala) 64-bit BE linux (ostrich) All were tested with HDF5_DRIVER set to "core_paged". --- src/H5FDcore.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 2f51264..ee3a40e 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -1381,16 +1381,26 @@ H5FD_core_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned UNUSED closing) fprintf(stderr, "FLUSHING. DIRTY LIST:\n"); #endif while(NULL != (item = (H5FD_core_region_t *)H5SL_remove_first(file->dirty_list))) { - size = (size_t)((item->end - item->start) + 1); + + /* The file may have been truncated, so check for that + * and skip or adjust as necessary. + */ + if(item->start < file->eof) { + if(item->end >= file->eof) + item->end = file->eof - 1; + + + size = (size_t)((item->end - item->start) + 1); #ifdef DER fprintf(stderr, "(%llu, %llu : %lu)\n", item->start, item->end, size); #endif - if(H5FD_core_write_to_bstore(file, item->start, size) != SUCCEED) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write to backing store") + if(H5FD_core_write_to_bstore(file, item->start, size) != SUCCEED) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write to backing store") + } /* end if */ + item = H5FL_FREE(H5FD_core_region_t, item); - } + } /* end while */ - #ifdef DER fprintf(stderr, "EOF: %llu\n", file->eof); fprintf(stderr, "EOA: %llu\n", file->eoa); -- cgit v0.12