summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-11-12 13:52:09 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-11-12 13:52:09 (GMT)
commit5901271ee7f3d52912c010f5ed22a61d16984f92 (patch)
tree54302ccf532310b79b50094585257ab626b5e51c
parent598a66048abae0d5465b7020b6fdeeb541a9c0f7 (diff)
downloadhdf5-5901271ee7f3d52912c010f5ed22a61d16984f92.zip
hdf5-5901271ee7f3d52912c010f5ed22a61d16984f92.tar.gz
hdf5-5901271ee7f3d52912c010f5ed22a61d16984f92.tar.bz2
[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
-rw-r--r--src/H5Dint.c10
1 files 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: