summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5VLint.c20
-rw-r--r--test/h5test.c12
2 files changed, 17 insertions, 15 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")
diff --git a/test/h5test.c b/test/h5test.c
index 255932a..497a5f2 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -2255,15 +2255,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-h5_check_if_file_locking_enabled(hbool_t *are_enabled)
+h5_check_if_file_locking_enabled(hbool_t *is_enabled)
{
const char *filename = "locking_test_file";
- mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
+ int pmode = O_RDWR | O_CREAT | O_TRUNC;
int fd = -1;
- *are_enabled = TRUE;
+ *is_enabled = TRUE;
- if((fd = HDcreat(filename, mode)) < 0)
+ if((fd = HDopen(filename, pmode, H5_POSIX_CREATE_MODE_RW)) < 0)
goto error;
/* Test HDflock() to see if it works */
@@ -2277,7 +2277,7 @@ h5_check_if_file_locking_enabled(hbool_t *are_enabled)
* error condition.
*/
errno = 0;
- *are_enabled = FALSE;
+ *is_enabled = FALSE;
}
else
goto error;
@@ -2293,7 +2293,7 @@ h5_check_if_file_locking_enabled(hbool_t *are_enabled)
return SUCCEED;
error:
- *are_enabled = FALSE;
+ *is_enabled = FALSE;
if (fd > -1) {
HDclose(fd);
HDremove(filename);