summaryrefslogtreecommitdiffstats
path: root/src/H5Gnode.c
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2003-09-04 21:43:37 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2003-09-04 21:43:37 (GMT)
commitbd346629483722e7bae94521a33df4ec7a58bf0b (patch)
tree3e3dbb686c65cd01404457c35c71d652be602c56 /src/H5Gnode.c
parent85637509083b9a0cc9b90f86865613a21a8d3968 (diff)
downloadhdf5-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/H5Gnode.c')
-rw-r--r--src/H5Gnode.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 3524159..d70a5c0 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -977,8 +977,10 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
if (H5G_node_create(f, dxpl_id, H5B_INS_FIRST, NULL, NULL, NULL,
new_node_p/*out*/)<0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to split symbol table node");
- if (NULL==(snrt=H5AC_find(f, dxpl_id, H5AC_SNODE, *new_node_p, NULL, NULL)))
+
+ if (NULL == (snrt = H5AC_protect(f, dxpl_id, H5AC_SNODE, *new_node_p, NULL, NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to split symbol table node");
+
HDmemcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f),
H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t));
snrt->nsyms = H5F_SYM_LEAF_K(f);
@@ -1007,6 +1009,8 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
}
}
+ if (snrt && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, *new_node_p, snrt, FALSE) != SUCCEED)
+ HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node");
} else {
/* Where to insert the new entry? */
ret_value = H5B_INS_NOOP;
@@ -1285,7 +1289,6 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr,
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed");
for (i=0; i<nsyms; i++)
name_off[i] = sn->entry[i].name_off;
- sn = NULL;
/*
* Iterate over the symbol table node entries.