summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2002-09-30 21:51:05 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2002-09-30 21:51:05 (GMT)
commit8410a8536536ad6bdde5f09e643a9123df555460 (patch)
tree4684a484d6e75974dd83655f942d01524d5df719
parenta4bb3150b8c6847891129a7c6fe1d7551dd80d27 (diff)
downloadhdf5-8410a8536536ad6bdde5f09e643a9123df555460.zip
hdf5-8410a8536536ad6bdde5f09e643a9123df555460.tar.gz
hdf5-8410a8536536ad6bdde5f09e643a9123df555460.tar.bz2
[svn-r5954]
Purpose: a bug fix Description: When a file is opened for a second time, file close degree is supposed to be either the same as the first open, or default as the first open is also default. Platforms tested: Linux 2.2(eirene), Solaris 2.7(arabica), IRIX64 6.5(modi4)
-rw-r--r--src/H5F.c9
-rw-r--r--src/H5FDcore.c3
-rw-r--r--test/tfile.c2
3 files changed, 10 insertions, 4 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 0a9c64d..ec0fb31 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -2046,8 +2046,13 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
else
shared->fc_degree = fc_degree;
} else if(shared->nrefs > 1) {
- if(fc_degree != shared->fc_degree)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match");
+ if(fc_degree==H5F_CLOSE_DEFAULT) {
+ if(shared->fc_degree != H5F_CLOSE_DEFAULT && shared->fc_degree!=shared->lf->cls->fc_degree)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match");
+ } else {
+ if(fc_degree != shared->fc_degree)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match");
+ }
}
/* Success */
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index cb36223..cea3834 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -85,6 +85,7 @@ static haddr_t H5FD_core_get_eoa(H5FD_t *_file);
static herr_t H5FD_core_set_eoa(H5FD_t *_file, haddr_t addr);
static haddr_t H5FD_core_get_eof(H5FD_t *_file);
static herr_t H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle);
+static H5F_close_degree_t H5FD_core_get_fc_degree(H5FD_t *_file);
static herr_t H5FD_core_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
size_t size, void *buf);
static herr_t H5FD_core_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
@@ -652,7 +653,7 @@ H5FD_core_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle)
done:
FUNC_LEAVE(ret_value);
}
-
+
/*-------------------------------------------------------------------------
* Function: H5FD_core_read
diff --git a/test/tfile.c b/test/tfile.c
index 07f8976..27b3601 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -511,7 +511,7 @@ test_file_close(void)
fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, fapl_id);
VERIFY(fid2, FAIL, "H5Fopen");
- ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_WEAK);
+ ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_DEFAULT);
CHECK(ret, FAIL, "H5Pset_fclose_degree");
/* should succeed */