summaryrefslogtreecommitdiffstats
path: root/src/H5Fsuper.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-07-22 17:20:00 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-07-22 17:20:00 (GMT)
commit1f685d5d53ce22fd4e079b60634ba27ec9e1449c (patch)
tree682341db2c3f006da494bc61de58281b8cb4ce7c /src/H5Fsuper.c
parentcba920a0368787d36ac2f1a8a791198fbc4945e5 (diff)
downloadhdf5-1f685d5d53ce22fd4e079b60634ba27ec9e1449c.zip
hdf5-1f685d5d53ce22fd4e079b60634ba27ec9e1449c.tar.gz
hdf5-1f685d5d53ce22fd4e079b60634ba27ec9e1449c.tar.bz2
[svn-r19124] Description:
Add some error checking to the process of creating superblock extension. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
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 f9b6b0c..a259dde 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)