summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-11-16 00:46:30 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-11-16 00:46:30 (GMT)
commitda16ec38eb79823243f5bcc6d70905ddfed31c53 (patch)
tree923927f998ab7b0e747faa805ca0c2aaa29b6d0c
parentf76495cdf558489c141bf76f6938d10dd6e9d10b (diff)
downloadhdf5-da16ec38eb79823243f5bcc6d70905ddfed31c53.zip
hdf5-da16ec38eb79823243f5bcc6d70905ddfed31c53.tar.gz
hdf5-da16ec38eb79823243f5bcc6d70905ddfed31c53.tar.bz2
[svn-r11730] Purpose:
Bug fix Description: Correct use of H5Gget_objinfo() which recent compact group checkins exposed: we were attempting to follow dangling soft links. Solution: Don't follow links for H5Gget_objinfo() when initializing object tables for h5dump. Platforms tested: Solaris 2.8 w/64-bit enabled Linux 2.4 FreeBSD 4.11 (sleipnir)
-rw-r--r--tools/lib/h5tools_utils.c118
1 files changed, 60 insertions, 58 deletions
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 764d8b2..3e63c56 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -485,80 +485,82 @@ find_objs_cb(hid_t group, const char *name, void *op_data)
find_objs_t *info = (find_objs_t*)op_data;
herr_t ret_value = 0;
- H5Gget_objinfo(group, name, TRUE, &statbuf);
+ if(H5Gget_objinfo(group, name, FALSE, &statbuf) < 0)
+ ret_value = FAIL;
+ else {
+ switch (statbuf.type) {
+ char *tmp;
- switch (statbuf.type) {
- char *tmp;
+ case H5G_GROUP:
+ if (search_obj(info->group_table, statbuf.u.obj.objno) == NULL) {
+ char *old_prefix;
- case H5G_GROUP:
- if (search_obj(info->group_table, statbuf.u.obj.objno) == NULL) {
- char *old_prefix;
+ tmp = build_obj_path_name(info->prefix, name);
+ add_obj(info->group_table, statbuf.u.obj.objno, tmp, TRUE);
- tmp = build_obj_path_name(info->prefix, name);
- add_obj(info->group_table, statbuf.u.obj.objno, tmp, TRUE);
+ old_prefix = info->prefix;
+ info->prefix = tmp;
- old_prefix = info->prefix;
- info->prefix = tmp;
+ if(H5Giterate(group, name, NULL, find_objs_cb, (void *)info) < 0)
+ ret_value = FAIL;
- if(H5Giterate(group, name, NULL, find_objs_cb, (void *)info) < 0)
- ret_value = FAIL;
+ info->prefix = old_prefix;
+ } /* end if */
+ break;
- info->prefix = old_prefix;
- } /* end if */
- break;
+ case H5G_DATASET:
+ if (search_obj(info->dset_table, statbuf.u.obj.objno) == NULL) {
+ hid_t dset;
- case H5G_DATASET:
- if (search_obj(info->dset_table, statbuf.u.obj.objno) == NULL) {
- hid_t dset;
+ tmp = build_obj_path_name(info->prefix, name);
+ add_obj(info->dset_table, statbuf.u.obj.objno, tmp, TRUE);
- tmp = build_obj_path_name(info->prefix, name);
- add_obj(info->dset_table, statbuf.u.obj.objno, tmp, TRUE);
+ if ((dset = H5Dopen (group, name)) >= 0) {
+ hid_t type;
- if ((dset = H5Dopen (group, name)) >= 0) {
- hid_t type;
+ type = H5Dget_type(dset);
- type = H5Dget_type(dset);
+ if (H5Tcommitted(type) > 0) {
+ H5Gget_objinfo(type, ".", TRUE, &statbuf);
- if (H5Tcommitted(type) > 0) {
- H5Gget_objinfo(type, ".", TRUE, &statbuf);
+ if (search_obj(info->type_table, statbuf.u.obj.objno) == NULL) {
+ char *type_name = HDstrdup(tmp);
- if (search_obj(info->type_table, statbuf.u.obj.objno) == NULL) {
- char *type_name = HDstrdup(tmp);
+ add_obj(info->type_table, statbuf.u.obj.objno, type_name, FALSE);
+ } /* end if */
+ }
- add_obj(info->type_table, statbuf.u.obj.objno, type_name, FALSE);
- } /* end if */
+ H5Tclose(type);
+ H5Dclose(dset);
+ } else {
+ ret_value = FAIL;
}
+ } /* end if */
+ break;
- H5Tclose(type);
- H5Dclose(dset);
- } else {
- ret_value = FAIL;
- }
- } /* end if */
- break;
-
- case H5G_TYPE:
- {
- obj_t *found_obj;
-
- tmp = build_obj_path_name(info->prefix, name);
- if ((found_obj = search_obj(info->type_table, statbuf.u.obj.objno)) == NULL)
- add_obj(info->type_table, statbuf.u.obj.objno, tmp, TRUE);
- else {
- /* Use latest version of name */
- HDfree(found_obj->objname);
- found_obj->objname = HDstrdup(tmp);
-
- /* Mark named datatype as having valid name */
- found_obj->recorded = TRUE;
- } /* end else */
- break;
- }
+ case H5G_TYPE:
+ {
+ obj_t *found_obj;
- default:
- /* Ignore links, etc. */
- break;
- }
+ tmp = build_obj_path_name(info->prefix, name);
+ if ((found_obj = search_obj(info->type_table, statbuf.u.obj.objno)) == NULL)
+ add_obj(info->type_table, statbuf.u.obj.objno, tmp, TRUE);
+ else {
+ /* Use latest version of name */
+ HDfree(found_obj->objname);
+ found_obj->objname = HDstrdup(tmp);
+
+ /* Mark named datatype as having valid name */
+ found_obj->recorded = TRUE;
+ } /* end else */
+ break;
+ }
+
+ default:
+ /* Ignore links, etc. */
+ break;
+ }
+ } /* end else */
return ret_value;
}