diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-08-25 17:16:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-08-25 17:16:13 (GMT) |
commit | 3ddfe595184b59e964c761220cf9452a7f8bacb5 (patch) | |
tree | b90102fc284f2c7dedad2f9f5492beb7b3dbfc62 /src/H5F.c | |
parent | 41b834c45c888be190e6e27ef5b0cb8a49e14026 (diff) | |
download | hdf5-3ddfe595184b59e964c761220cf9452a7f8bacb5.zip hdf5-3ddfe595184b59e964c761220cf9452a7f8bacb5.tar.gz hdf5-3ddfe595184b59e964c761220cf9452a7f8bacb5.tar.bz2 |
[svn-r11296] Purpose:
Bug fix
Description:
Fix "strong" file closing to handle a dangling dataset which uses a
dangling named datatype.
Platforms tested:
FreeBSD 4.11 (sleipnir)
Too minor too require h5committest
Diffstat (limited to 'src/H5F.c')
-rw-r--r-- | src/H5F.c | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -2463,8 +2463,21 @@ H5F_try_close(H5F_t *f) hid_t objs[128]; /* Array of objects to close */ unsigned u; /* Local index variable */ - /* Get the list of IDs of open dataset, group, named datatype & attribute objects */ - while((obj_count = H5F_get_obj_ids(f, H5F_OBJ_LOCAL|H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR, (int)(sizeof(objs)/sizeof(objs[0])), objs)) != 0) { + /* Get the list of IDs of open dataset, group, & attribute objects */ + while((obj_count = H5F_get_obj_ids(f, H5F_OBJ_LOCAL|H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_ATTR, (int)(sizeof(objs)/sizeof(objs[0])), objs)) != 0) { + + /* Try to close all the open objects in this file */ + for(u = 0; u < obj_count; u++) + if(H5I_dec_ref(objs[u]) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object") + } /* end while */ + + /* Get the list of IDs of open named datatype objects */ + /* (Do this separately from the dataset & attribute IDs, because + * they could be using one of the named datatypes and then the + * open named datatype ID will get closed twice. + */ + while((obj_count = H5F_get_obj_ids(f, H5F_OBJ_LOCAL|H5F_OBJ_DATATYPE, (int)(sizeof(objs)/sizeof(objs[0])), objs)) != 0) { /* Try to close all the open objects in this file */ for(u = 0; u < obj_count; u++) |