[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)
This commit is contained in:
Raymond Lu 2002-09-30 16:51:05 -05:00
parent a4bb3150b8
commit 8410a85365
3 changed files with 10 additions and 4 deletions

View File

@ -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 */

View File

@ -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

View File

@ -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 */