diff options
author | Jordan Henderson <jhenderson@hdfgroup.org> | 2020-08-10 22:36:07 (GMT) |
---|---|---|
committer | Jordan Henderson <jhenderson@hdfgroup.org> | 2020-08-10 22:36:07 (GMT) |
commit | af390794f400ca3bd19597dbdd5031edcd675239 (patch) | |
tree | 997bb99f7b378ed8336d8303f2fdb93d83f21c38 | |
parent | c0ff30d23948dd8801f231ea178fd8051c5c08dd (diff) | |
parent | 7c3d4402d730789173e413b48951fede5f6932f3 (diff) | |
download | hdf5-af390794f400ca3bd19597dbdd5031edcd675239.zip hdf5-af390794f400ca3bd19597dbdd5031edcd675239.tar.gz hdf5-af390794f400ca3bd19597dbdd5031edcd675239.tar.bz2 |
Merge pull request #2655 in HDFFV/hdf5 from ~JHENDERSON/hdf5:develop to develop
* commit '7c3d4402d730789173e413b48951fede5f6932f3':
Fix issue in H5VL_wrap_register where datatype VOL objects are casted to H5T_t *
-rw-r--r-- | src/H5VLint.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/H5VLint.c b/src/H5VLint.c index 861629f..98785f8 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -2363,23 +2363,25 @@ H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) /* Sanity check */ HDassert(obj); + /* Retrieve the VOL object wrapping context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") + if(NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->connector) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "VOL object wrap context or its connector is NULL???") + /* If the datatype is already VOL-managed, the datatype's vol_obj * field will get clobbered later, so disallow this. */ - if(type == H5I_DATATYPE) - if(TRUE == H5T_already_vol_managed((const H5T_t *)obj)) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype") + if(type == H5I_DATATYPE) { + if(vol_wrap_ctx->connector->id == H5VL_NATIVE) + if(TRUE == H5T_already_vol_managed((const H5T_t *)obj)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype") + } /* Wrap the object with VOL connector info */ if(NULL == (new_obj = H5VL__wrap_obj(obj, type))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object") - /* Retrieve the VOL object wrapping context */ - if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") - if(NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->connector) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "VOL object wrap context or its connector is NULL???") - /* Get an ID for the object */ if((ret_value = H5VL_register_using_vol_id(type, new_obj, vol_wrap_ctx->connector->id, app_ref)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") |