summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2006-11-08 21:24:41 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2006-11-08 21:24:41 (GMT)
commit89cca34b9763e12a73a86164306d5ffbede28f64 (patch)
tree1822cc905222f9e4dd557ae4ac0de1608dcd33f5 /tools/lib
parenta9350e86f0a04cc1f6aba59849063d4acfa1be7b (diff)
downloadhdf5-89cca34b9763e12a73a86164306d5ffbede28f64.zip
hdf5-89cca34b9763e12a73a86164306d5ffbede28f64.tar.gz
hdf5-89cca34b9763e12a73a86164306d5ffbede28f64.tar.bz2
[svn-r12883]
h5dump bug 701. Symptom: The creation of a hardlink pointing to the root group "/" causes h5dump to display it as a link pointing to itself. Cure: the root group was not being inserted in the table that keeps track of object names and links. Added a test for this in the test generation program, the creation of a hardlink to the root
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5tools_utils.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index c1fa292..3dbafa5 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -600,6 +600,26 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
info->type_table = *type_table;
info->dset_table = *dset_table;
+ {
+ /* add the root group as an object, it may have hard links to it */
+
+ H5G_stat_t statbuf;
+ haddr_t objno; /* compact form of object's location */
+ char* tmp;
+
+ if(H5Gget_objinfo(fid, "/", FALSE, &statbuf) < 0)
+ return FAIL;
+ else
+ {
+ objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
+ /* call with an empty string, it appends group separator */
+ tmp = build_obj_path_name(info->prefix, "");
+ add_obj(info->group_table, objno, tmp, TRUE);
+ }
+ }
+
+
+
/* Find all shared objects */
return(H5Giterate(fid, "/", NULL, find_objs_cb, (void *)info));
}