From 2104bb380da40cd8ceae6277a297dd0ed35a618f Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Tue, 24 Oct 2006 19:02:56 -0500 Subject: [svn-r12809] Purpose: Bug fix. Description: H5FD_get_vfd_handle() would return okay even if an VFD did not have the get_vfd_handle callback function defined. Solution: Return failure if get_vfd_handle function is not defined. Tested: in heping and copper. --- src/H5FD.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/H5FD.c b/src/H5FD.c index 952bad9..58e6188 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -3783,8 +3783,10 @@ herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle) FUNC_ENTER_NOAPI(H5FD_get_vfd_handle, FAIL) assert(file_handle); - if(file->cls->get_handle && ((ret_value=file->cls->get_handle(file, fapl, file_handle)) < 0)) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver") + if(NULL==file->cls->get_handle) + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `get_vfd_handle' method"); + if((ret_value=file->cls->get_handle(file, fapl, file_handle)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver"); done: FUNC_LEAVE_NOAPI(ret_value) -- cgit v0.12