diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-08-25 17:16:02 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-08-25 17:16:02 (GMT) |
commit | ab6656c52c8186fc9bca911f7dfb4df967b26817 (patch) | |
tree | cfe481ed9b6cd408414c0f5e05d2c9bd0fc6c6f9 /src/H5F.c | |
parent | 4a6e1b6ba9287ba1ea84e9c09950aac5be09a59e (diff) | |
download | hdf5-ab6656c52c8186fc9bca911f7dfb4df967b26817.zip hdf5-ab6656c52c8186fc9bca911f7dfb4df967b26817.tar.gz hdf5-ab6656c52c8186fc9bca911f7dfb4df967b26817.tar.bz2 |
[svn-r11295] 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
@@ -2677,8 +2677,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++) |