mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-01 16:28:09 +08:00
[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)
This commit is contained in:
parent
f76495cdf5
commit
da16ec38eb
@ -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;
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* Mark named datatype as having valid name */
|
||||
found_obj->recorded = TRUE;
|
||||
} /* end else */
|
||||
break;
|
||||
default:
|
||||
/* Ignore links, etc. */
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
/* Ignore links, etc. */
|
||||
break;
|
||||
}
|
||||
} /* end else */
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user