diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2012-02-07 15:49:44 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2012-02-07 15:49:44 (GMT) |
commit | a7c969372e8bdc0e66f0e15f204185360bb0e60b (patch) | |
tree | 75aeb08891459b2603319d242afe16c70a3565da /src | |
parent | 4596ad79a992308e4cc0a6e4a6493fe48bd3bf8b (diff) | |
download | hdf5-a7c969372e8bdc0e66f0e15f204185360bb0e60b.zip hdf5-a7c969372e8bdc0e66f0e15f204185360bb0e60b.tar.gz hdf5-a7c969372e8bdc0e66f0e15f204185360bb0e60b.tar.bz2 |
[svn-r21912] Issue 7756 - Creating a dataset in a read-only file caused seg fault when the file is closed. I fixed the problem by putting a condition check early in H5O_create of H5O.c. The old code checked it too late, not until a file space is created. I added a test case in tfile.c to check the creation of group, dataset, attribute, and datatype.
Tested on jam - I've tested the same changes in the trunk with h5committest.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5O.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1121,10 +1121,12 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc, /* check args */ HDassert(f); - HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); HDassert(loc); HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE)); + /* Check for invalid access request */ + if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "no write intent on file") /* Make certain we allocate at least a reasonable size for the object header */ size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint)); |