diff options
Diffstat (limited to 'tools/h5repack/h5repack_refs.c')
-rw-r--r-- | tools/h5repack/h5repack_refs.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index 0db17f5..1a09b02 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -748,8 +748,14 @@ static const char* MapIdToName(hid_t refobj_id, { hid_t id; hid_t fid; + H5G_stat_t refstat; /* Stat for the refobj id */ + H5G_stat_t objstat; /* Stat for objects in the file */ int i; + /* obtain information to identify the referenced object uniquely */ + if(H5Gget_objinfo(refobj_id, ".", 0, &refstat) <0) + return NULL; + /* obtains the file ID given an object ID. This ID must be closed */ if ((fid = H5Iget_file_id(refobj_id))<0) { @@ -773,9 +779,11 @@ static const char* MapIdToName(hid_t refobj_id, if ((id = H5Dopen(fid,travt->objs[i].name))<0) return NULL; + if(H5Gget_objinfo(id, ".", 0, &objstat) <0) + return NULL; if (H5Dclose(id)<0) return NULL; - if (id==refobj_id) + if (refstat.fileno==objstat.fileno && refstat.objno==objstat.objno) { H5Fclose(fid); return travt->objs[i].name; |