summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2013-04-29 19:23:04 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2013-04-29 19:23:04 (GMT)
commitbada3f7a86cb30b24fad3a24f88114861527ed58 (patch)
tree3f351f78649e966c2521c606082ad63e860e81c1 /src/H5D.c
parent029e143471397de6ddc204be0c21f0c04ee5f2e2 (diff)
downloadhdf5-bada3f7a86cb30b24fad3a24f88114861527ed58.zip
hdf5-bada3f7a86cb30b24fad3a24f88114861527ed58.tar.gz
hdf5-bada3f7a86cb30b24fad3a24f88114861527ed58.tar.bz2
[svn-r23656] Issue 8380 H5Zunregister caused seg fault: I added some protection measures:
1. If any opened object uses the filter, let it fail. 2. Flush all opened files to push any cached data to files. Tested with h5committest.
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c47
1 files changed, 42 insertions, 5 deletions
diff --git a/src/H5D.c b/src/H5D.c
index d204712..d81d4c7 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -572,19 +572,56 @@ done:
hid_t
H5Dget_create_plist(hid_t dset_id)
{
- H5D_t *dset; /* Dataset structure */
+ H5D_t *dataset; /* Dataset structure */
H5P_genplist_t *dcpl_plist; /* Dataset's DCPL */
H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */
H5O_fill_t copied_fill; /* Fill value to tweak */
hid_t new_dcpl_id = FAIL;
- hid_t ret_value; /* Return value */
+ hid_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("i", "i", dset_id);
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+
+ if((ret_value = H5D_get_create_plist(dataset)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Dget_create_plist() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_get_create_plist
+ *
+ * Purpose: Private function for H5Dget_create_plist
+ *
+ * Return: Success: ID for a copy of the dataset creation
+ * property list. The template should be
+ * released by calling H5P_close().
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, February 3, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5D_get_create_plist(H5D_t *dset)
+{
+ H5P_genplist_t *dcpl_plist; /* Dataset's DCPL */
+ H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */
+ H5O_fill_t copied_fill; /* Fill value to tweak */
+ hid_t new_dcpl_id = FAIL;
+ hid_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args */
if(NULL == (dcpl_plist = (H5P_genplist_t *)H5I_object(dset->shared->dcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
@@ -670,8 +707,8 @@ done:
if(H5I_dec_app_ref(new_dcpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object")
- FUNC_LEAVE_API(ret_value)
-} /* end H5Dget_create_plist() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D_get_create_plist() */
/*-------------------------------------------------------------------------