diff options
author | Bill Wendling <wendling@ncsa.uiuc.edu> | 2003-09-04 21:43:37 (GMT) |
---|---|---|
committer | Bill Wendling <wendling@ncsa.uiuc.edu> | 2003-09-04 21:43:37 (GMT) |
commit | bd346629483722e7bae94521a33df4ec7a58bf0b (patch) | |
tree | 3e3dbb686c65cd01404457c35c71d652be602c56 /src/H5O.c | |
parent | 85637509083b9a0cc9b90f86865613a21a8d3968 (diff) | |
download | hdf5-bd346629483722e7bae94521a33df4ec7a58bf0b.zip hdf5-bd346629483722e7bae94521a33df4ec7a58bf0b.tar.gz hdf5-bd346629483722e7bae94521a33df4ec7a58bf0b.tar.bz2 |
[svn-r7445] Purpose:
Fix, of a sort
Description:
Some of the code would get an object from the cache via the
H5AC_find() function and then modify the returned object. This
behavior is incorrect as the pointer returned via the H5AC_find()
function is supposed to be read only.
Solution:
Changed the H5AC_finds to H5AC_protect() instead and added the
appropriate H5AC_unprotect() function.
Platforms tested:
(simulated h5committest by hand since it doesn't work for me)
Linux (Fortran, C++)
Solaris (Fortran)
AIX (Fortran, C++)
SGI (Parallel, Fortran)
Diffstat (limited to 'src/H5O.c')
-rw-r--r-- | src/H5O.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1648,7 +1648,7 @@ H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5O_class_t **type assert(type_p); /* Load the object header */ - if (NULL == (oh = H5AC_find(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL))) + if (NULL == (oh = H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, UFAIL, "unable to load object header"); /* Scan through the messages looking for the right one */ @@ -1687,6 +1687,9 @@ H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5O_class_t **type ret_value=u; done: + if (oh && H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, FALSE) != SUCCEED && ret_value != UFAIL) + HDONE_ERROR(H5E_OHDR, H5E_PROTECT, UFAIL, "unable to release object header"); + FUNC_LEAVE_NOAPI(ret_value); } |