summaryrefslogtreecommitdiffstats
path: root/src/H5F.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-09-04 02:05:16 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-09-04 02:05:16 (GMT)
commit80d6d8e4727b438194a881b57a35e72d029550bb (patch)
treeda7b3d5f97309b9bd7e1986c4f43aaf3969646e1 /src/H5F.c
parent4c4a93612e4e48c2d60eb7c1b1f5c8702e540d6f (diff)
downloadhdf5-80d6d8e4727b438194a881b57a35e72d029550bb.zip
hdf5-80d6d8e4727b438194a881b57a35e72d029550bb.tar.gz
hdf5-80d6d8e4727b438194a881b57a35e72d029550bb.tar.bz2
[svn-r7442] 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.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 5ac2d6f..a99c3e7 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -922,14 +922,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) {
@@ -1812,6 +1816,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;
int super_vers; /* Superblock version # */
@@ -1838,7 +1843,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