summaryrefslogtreecommitdiffstats
path: root/src/H5Oattribute.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-04-01 22:27:15 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-04-01 22:27:15 (GMT)
commit362f22119d9cb25424f7cdf181219bfa6330b6b8 (patch)
tree4ffa1e4be8fecd337594ef32cc1da95c16bdf615 /src/H5Oattribute.c
parent7022c013acb0ffac172d0ef99aa7d0205ab842c8 (diff)
downloadhdf5-362f22119d9cb25424f7cdf181219bfa6330b6b8.zip
hdf5-362f22119d9cb25424f7cdf181219bfa6330b6b8.tar.gz
hdf5-362f22119d9cb25424f7cdf181219bfa6330b6b8.tar.bz2
[svn-r22228] Description:
Bring r22219 from trunk to 1.8 branch: (with release manager's blessing) Merge "file image" changes from feature branch back to trunk. Tested on: h5committested
Diffstat (limited to 'src/H5Oattribute.c')
-rw-r--r--src/H5Oattribute.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index bbaf72b..0ab74ac 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -711,18 +711,23 @@ H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_t
HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "can't get file serial number")
/* Count all opened attributes */
- num_open_attr = H5F_get_obj_count(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, FALSE);
+ if(H5F_get_obj_count(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, FALSE, &num_open_attr) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't count opened attributes")
/* Find out whether the attribute has been opened */
if(num_open_attr) {
+ size_t check_num_attr; /* Number of open attribute IDs */
size_t u; /* Local index variable */
/* Allocate space for the attribute ID list */
if(NULL == (attr_id_list = (hid_t *)H5MM_malloc(num_open_attr * sizeof(hid_t))))
- HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "unable to allocate memory for attribute ID list")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "unable to allocate memory for attribute ID list")
/* Retrieve the IDs of all opened attributes */
- H5F_get_obj_ids(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, num_open_attr, attr_id_list, FALSE);
+ if(H5F_get_obj_ids(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, num_open_attr, attr_id_list, FALSE, &check_num_attr) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get IDs of opened attributes")
+ if(check_num_attr != num_open_attr)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "open attribute count mismatch")
/* Iterate over the attributes */
for(u = 0; u < num_open_attr; u++) {