summaryrefslogtreecommitdiffstats
path: root/src/H5Tcommit.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2009-10-27 21:08:58 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2009-10-27 21:08:58 (GMT)
commit22eb024930bc6bc01de150347bc7ec6aa59b8400 (patch)
tree90cf050e3e4f4c41a8acc4c83428c079065f8088 /src/H5Tcommit.c
parent312d3d4b2e4f4954aeb752de2362ca88f3d86a16 (diff)
downloadhdf5-22eb024930bc6bc01de150347bc7ec6aa59b8400.zip
hdf5-22eb024930bc6bc01de150347bc7ec6aa59b8400.tar.gz
hdf5-22eb024930bc6bc01de150347bc7ec6aa59b8400.tar.bz2
[svn-r17754] Purpose: Fix assertion failure caused by H5Tcommit1/2
Description: Calling H5Tcommit1 or H5Tcommit2 on a file with read only access would cause an assertion failure. Added a check to H5T_commit_named to return a failure in this case. Tested: Fedora 11 (very minor change)
Diffstat (limited to 'src/H5Tcommit.c')
-rw-r--r--src/H5Tcommit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index f580c15..ebdf283 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -199,6 +199,10 @@ H5T_commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt,
HDassert(tapl_id != H5P_DEFAULT);
HDassert(dxpl_id != H5P_DEFAULT);
+ /* Check if we are allowed to write to this file */
+ if(0 == (H5F_INTENT(loc->oloc->file) & H5F_ACC_RDWR))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "no write intent on file")
+
/* Record the type's state so that we can revert to it if linking fails */
old_state = dt->shared->state;