diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2012-01-25 20:06:09 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2012-01-25 20:06:09 (GMT) |
commit | 394caf9adf2249735ef4b6c707c65e3c587d84ac (patch) | |
tree | 40230000cfe4d604846444d7b543b8aed11178c5 /src | |
parent | 13ef2d1fbbc50956c1cea1d28462a974c8e036a6 (diff) | |
download | hdf5-394caf9adf2249735ef4b6c707c65e3c587d84ac.zip hdf5-394caf9adf2249735ef4b6c707c65e3c587d84ac.tar.gz hdf5-394caf9adf2249735ef4b6c707c65e3c587d84ac.tar.bz2 |
[svn-r21891] 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 koala, jam, and linew.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5O.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1122,10 +1122,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_CACHE, 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)); |