mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-23 16:20:57 +08:00
[svn-r5955]
Purpose: a bug fix Description: modify the condition check for the file close degree. Platforms tested: Linux 2.2(eirene), Solaris 2.7(arabica), IRIX64 6.5(modi4)
This commit is contained in:
parent
8410a85365
commit
09325c1da6
16
src/H5F.c
16
src/H5F.c
@ -2042,19 +2042,16 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
|
||||
|
||||
if(shared->nrefs == 1) {
|
||||
if(fc_degree == H5F_CLOSE_DEFAULT)
|
||||
shared->fc_degree = H5F_CLOSE_DEFAULT;
|
||||
shared->fc_degree = shared->lf->cls->fc_degree;
|
||||
else
|
||||
shared->fc_degree = fc_degree;
|
||||
} else if(shared->nrefs > 1) {
|
||||
if(fc_degree==H5F_CLOSE_DEFAULT) {
|
||||
if(shared->fc_degree != H5F_CLOSE_DEFAULT && shared->fc_degree!=shared->lf->cls->fc_degree)
|
||||
if(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)
|
||||
if(fc_degree!=H5F_CLOSE_DEFAULT && fc_degree != shared->fc_degree)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Success */
|
||||
ret_value = file;
|
||||
|
||||
@ -2687,10 +2684,7 @@ H5F_close(H5F_t *f)
|
||||
assert(1==f->nrefs);
|
||||
|
||||
/* Get the close degree from the file */
|
||||
if(f->shared->fc_degree == H5F_CLOSE_DEFAULT)
|
||||
fc_degree = f->shared->lf->cls->fc_degree;
|
||||
else
|
||||
fc_degree = f->shared->fc_degree;
|
||||
fc_degree = f->shared->fc_degree;
|
||||
|
||||
/* if close degree if "semi" and there are objects left open and we are
|
||||
* holding open the file with this file ID, fail now */
|
||||
|
25
test/tfile.c
25
test/tfile.c
@ -406,6 +406,31 @@ test_file_close(void)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
|
||||
|
||||
/* Test behavior while opening file multiple times with different file
|
||||
* close degree
|
||||
*/
|
||||
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
CHECK(fid1, FAIL, "H5Fcreate");
|
||||
|
||||
ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_WEAK);
|
||||
CHECK(ret, FAIL, "H5Pset_fclose_degree");
|
||||
|
||||
ret = H5Pget_fclose_degree(fapl_id, &fc_degree);
|
||||
VERIFY(fc_degree, H5F_CLOSE_WEAK, "H5Pget_fclose_degree");
|
||||
|
||||
/* should succeed */
|
||||
fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, fapl_id);
|
||||
CHECK(fid2, FAIL, "H5Fopen");
|
||||
|
||||
/* Close first open */
|
||||
ret = H5Fclose(fid1);
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
|
||||
/* Close second open */
|
||||
ret = H5Fclose(fid2);
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
|
||||
|
||||
/* Test behavior while opening file multiple times with file close
|
||||
* degree STRONG */
|
||||
ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG);
|
||||
|
Loading…
Reference in New Issue
Block a user