diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-09-04 02:04:45 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-09-04 02:04:45 (GMT) |
commit | 303d35202ab14f20dd393893bca92bb078813ed7 (patch) | |
tree | 6525eb7e6109b2d1580887fa2694bab2dfb18223 /src/H5F.c | |
parent | 8c174d260d4605ff75c37969d519913a67c6f93d (diff) | |
download | hdf5-303d35202ab14f20dd393893bca92bb078813ed7.zip hdf5-303d35202ab14f20dd393893bca92bb078813ed7.tar.gz hdf5-303d35202ab14f20dd393893bca92bb078813ed7.tar.bz2 |
[svn-r7441] Purpose:
Bug fix
Description:
The VFL driver ID in a file's access proprty list wasn't being reference
counted correctly, causing the VFL driver to get prematurely closed after
several calls to "H5Pget_access_plist->H5Pclose".
Solution:
Increment VFL driver ID reference count when copy of file's access property
list is made in H5Pget_access_plist()
Platforms tested:
FreeBSD 4.9 (sleipnir)
h5committest
Diffstat (limited to 'src/H5F.c')
-rw-r--r-- | src/H5F.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -897,14 +897,18 @@ H5Fget_access_plist(hid_t file_id) if (H5F_acs_close(ret_value, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't free the old driver information") + /* Increment the reference count on the driver ID and insert it into the property list */ + if(H5I_inc_ref(f->shared->lf->driver_id)<0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver") if(H5P_set(new_plist, H5F_ACS_FILE_DRV_ID_NAME, &(f->shared->lf->driver_id)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID") + /* Set the driver "info" in the property list */ driver_info = H5FD_fapl_get(f->shared->lf); - if(driver_info != NULL && H5P_set(new_plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver info") + /* Set the file close degree appropriately */ if(f->shared->fc_degree == H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_CLOSE_DEGREE_NAME, &(f->shared->lf->cls->fc_degree)) < 0) { HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") } else if(f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0) { @@ -1793,6 +1797,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d haddr_t stored_eoa; /*relative end-of-addr in file */ unsigned tent_flags; /*tentative flags */ char driver_name[9]; /*file driver name/version */ + H5FD_class_t *drvr; /* File driver class info */ hbool_t driver_has_cmp; /*`cmp' callback defined? */ hsize_t userblock_size = 0; unsigned super_vers; /* Superblock version # */ @@ -1819,7 +1824,9 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d * it is the application's responsibility to never open the same file * more than once at a time. */ - driver_has_cmp = H5FD_has_cmp(fapl_id); + if((drvr=H5FD_get_class(fapl_id))==NULL) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to retrieve VFL class") + driver_has_cmp = (NULL!=drvr->cmp); /* * Opening a file is a two step process. First we try to open the file in |