changed H5Pset_fclose_degree to H5F_CLOSE_WEAK

It seems like it is part of the design of HDF5 virtual datasets that
objects within a file remain opened while the files is aready "closed".
Setting the fclose degree to SEMI would cause the library to bail out.
This commit makes nc_test4/tst_virtual_dataset succeed.

See also Unidata/netcdf-c#1799
This commit is contained in:
Tobias Kölling 2020-09-02 16:16:57 +02:00
parent 4c27730ae3
commit 9f8897762d

View File

@ -756,12 +756,13 @@ nc4_open_file(const char *path, int mode, void* parameters, int ncid)
#endif /* !USE_PARALLEL4 */
/* Need this access plist to control how HDF5 handles open objects
* on file close. (Setting H5F_CLOSE_SEMI will cause H5Fclose to
* fail if there are any open objects in the file). */
* on file close. (Setting H5F_CLOSE_WEAK will cause H5Fclose not to
* fail if there are any open objects in the file. This may happen when virtual
* datasets are opened). */
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
BAIL(NC_EHDFERR);
if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI) < 0)
if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_WEAK) < 0)
BAIL(NC_EHDFERR);
#ifdef USE_PARALLEL4