From 5901271ee7f3d52912c010f5ed22a61d16984f92 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 12 Nov 2007 08:52:09 -0500 Subject: [svn-r14251] Description: Move setting the "update the dataset's dataspace" flag later in the process of changing it's extent. Also add explicit check for having write access to file, before attempting to perform any actions for changing the extent. Tested on: Linux/64 2.4 (smirom) w/parallel --- src/H5Dint.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index aebc6f2..762eb66 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2265,6 +2265,10 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) HDassert(dset); HDassert(size); + /* Check if we are allowed to modify this file */ + if(0 == (H5F_get_intent(dset->oloc.file) & H5F_ACC_RDWR)) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file") + /* Check if the filters in the DCPL will need to encode, and if so, can they? */ if(H5D_check_filters(dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't apply filters") @@ -2298,9 +2302,6 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) * Modify the dataset storage *------------------------------------------------------------------------- */ - /* Mark the dataspace as dirty, for later writing to the file */ - dset->shared->space_dirty = TRUE; - /* Update the index values for the cached chunks for this dataset */ if(H5D_CHUNKED == dset->shared->layout.type) if(H5D_istore_update_cache(dset, dxpl_id) < 0) @@ -2337,6 +2338,9 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) if(H5D_istore_initialize_by_extent(&io_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to initialize chunks ") } /* end if */ + + /* Mark the dataspace as dirty, for later writing to the file */ + dset->shared->space_dirty = TRUE; } /* end if */ done: -- cgit v0.12