summaryrefslogtreecommitdiffstats
path: root/src/H5Fsuper.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-07-22 18:47:07 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-07-22 18:47:07 (GMT)
commit697078568d2f9fa04b8dc6a8a40d269ad799523e (patch)
tree61578525bb2be6acd8abb24d9c6c0be2411787fc /src/H5Fsuper.c
parent42a3da6c700ca3634ef0aea8fb9701b85dc91370 (diff)
downloadhdf5-697078568d2f9fa04b8dc6a8a40d269ad799523e.zip
hdf5-697078568d2f9fa04b8dc6a8a40d269ad799523e.tar.gz
hdf5-697078568d2f9fa04b8dc6a8a40d269ad799523e.tar.bz2
[svn-r19126] Description:
Bring r19124 from trunk to 1.8 branch: Add some error checking to the process of creating superblock extension. Tested on: FreeBSD/32 6.3 (duty) in debug mode (h5committest performed on trunk)
Diffstat (limited to 'src/H5Fsuper.c')
-rw-r--r--src/H5Fsuper.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 4275069..0469f8a 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -189,12 +189,27 @@ H5F_super_ext_create(H5F_t *f, hid_t dxpl_id, H5O_loc_t *ext_ptr)
HDassert(!H5F_addr_defined(f->shared->sblock->ext_addr));
HDassert(ext_ptr);
- H5O_loc_reset(ext_ptr);
- if(H5O_create(f, dxpl_id, 0, H5P_GROUP_CREATE_DEFAULT, ext_ptr) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create superblock extension")
+ /* Check for older version of superblock format that can't support superblock extensions */
+ if(f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "superblock extension not permitted with version %u of superblock", f->shared->sblock->super_vers)
+ else if(H5F_addr_defined(f->shared->sblock->ext_addr))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "superblock extension already exists?!?!")
+ else {
+ /* The superblock extension isn't actually a group, but the
+ * default group creation list should work fine.
+ * If we don't supply a size for the object header, HDF5 will
+ * allocate H5O_MIN_SIZE by default. This is currently
+ * big enough to hold the biggest possible extension, but should
+ * be tuned if more information is added to the superblock
+ * extension.
+ */
+ H5O_loc_reset(ext_ptr);
+ if(H5O_create(f, dxpl_id, 0, H5P_GROUP_CREATE_DEFAULT, ext_ptr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create superblock extension")
- /* Record the address of the superblock extension */
- f->shared->sblock->ext_addr = ext_ptr->addr;
+ /* Record the address of the superblock extension */
+ f->shared->sblock->ext_addr = ext_ptr->addr;
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)