diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2013-04-29 19:23:04 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2013-04-29 19:23:04 (GMT) |
commit | bada3f7a86cb30b24fad3a24f88114861527ed58 (patch) | |
tree | 3f351f78649e966c2521c606082ad63e860e81c1 /src/H5I.c | |
parent | 029e143471397de6ddc204be0c21f0c04ee5f2e2 (diff) | |
download | hdf5-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/H5I.c')
-rw-r--r-- | src/H5I.c | 42 |
1 files changed, 38 insertions, 4 deletions
@@ -2002,21 +2002,55 @@ H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key) if(H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") + if((ret_value = H5I_search(type, func, key)) == NULL) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Isearch() */ + + +/*------------------------------------------------------------------------- + * Function: H5I_search + * + * Purpose: Private function for H5Isearch + * + * Return: Success: The first object in the type for which FUNC + * returns non-zero. NULL if FUNC returned zero + * for every object in the type. + * + * Failure: NULL + * + * Programmer: James Laird + * Nathaniel Furrer + * Friday, April 23, 2004 + * + *------------------------------------------------------------------------- + */ +void * +H5I_search(H5I_type_t _type, H5I_search_func_t _func, void *_key) +{ + H5I_search_ud_t udata; /* Context for iteration */ + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + /* Set up udata struct */ - udata.app_cb = func; - udata.app_key = key; + udata.app_cb = _func; + udata.app_key = _key; udata.ret_obj = NULL; /* Note that H5I_iterate returns an error code. We ignore it * here, as we can't do anything with it without revising the API. */ - H5I_iterate(type, H5I_search_cb, &udata, TRUE); + if(H5I_iterate(_type, H5I_search_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") /* Set return value */ ret_value = udata.ret_obj; done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Isearch() */ |