summaryrefslogtreecommitdiffstats
path: root/src/H5Gobj.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-07-15 21:00:15 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-07-15 21:00:15 (GMT)
commit516c63299f638bf0f9ab6d58268e8edf28515ed4 (patch)
tree2fa0ac337fd747bc96d131a0bc72429f32ed97e6 /src/H5Gobj.c
parent1572fb46e083a6d44235c77638752777106e86d3 (diff)
downloadhdf5-516c63299f638bf0f9ab6d58268e8edf28515ed4.zip
hdf5-516c63299f638bf0f9ab6d58268e8edf28515ed4.tar.gz
hdf5-516c63299f638bf0f9ab6d58268e8edf28515ed4.tar.bz2
[svn-r15367] Description:
Add check to avoid mounting the a file on a group twice, then the mounts are done on the same HDF5 file, but opened with separate H5Fopen calls. Also add new 'mounted' flag to the H5G_info_t struct, queried with the H5Gget_info() API call, to allow applications to detect and avoid this situation. This probably fixes Bz#1070 also, I'll check with Dan Anov (who reported a different sort of behavior, but seems to have the same underlying problem). Tested on: Mac OS X/32 10.5.4 (amazon) Linux/64 2.6 (chicago)
Diffstat (limited to 'src/H5Gobj.c')
-rw-r--r--src/H5Gobj.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 8ca8c52..e04c12d 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -702,6 +702,10 @@ done:
herr_t
H5G_obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id)
{
+ H5G_t *grp = NULL; /* Group to query */
+ H5G_loc_t grp_loc; /* Entry of group to be queried */
+ H5G_name_t grp_path; /* Group hier. path */
+ H5O_loc_t grp_oloc; /* Group object location */
H5O_linfo_t linfo; /* Link info message */
herr_t ret_value = SUCCEED; /* Return value */
@@ -711,6 +715,22 @@ H5G_obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id)
HDassert(oloc);
HDassert(grp_info);
+ /* Set up group location to fill in */
+ grp_loc.oloc = &grp_oloc;
+ grp_loc.path = &grp_path;
+ H5G_loc_reset(&grp_loc);
+
+ /* Deep copy (duplicate) of the group location object */
+ if(H5O_loc_copy(&grp_oloc, oloc, H5_COPY_DEEP) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "can't copy object location")
+
+ /* Open the group */
+ if(NULL == (grp = H5G_open(&grp_loc, dxpl_id)))
+ HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found")
+
+ /* Get information from the group */
+ grp_info->mounted = H5G_MOUNTED(grp);
+
/* Attempt to get the link info for this group */
if(H5G_obj_get_linfo(oloc, &linfo, dxpl_id)) {
/* Retrieve the information about the links */
@@ -737,6 +757,10 @@ H5G_obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id)
} /* end else */
done:
+ /* Clean up resources */
+ if(grp && H5G_close(grp) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "unable to close queried group")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_obj_info() */