From 7bd8d0f25e0c10cca68396962e4d6ea7f54cfb9e Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Thu, 2 Feb 2012 12:02:28 -0500 Subject: [svn-r21904] This is a followup commit for Issue 7756 - Creating a dataset in a read-only file caused seg fault when the file is closed. I changed the error ID from H5E_CACHE to H5E_OHDR in the error report macro in H5O_create and fixed a minor problem in tfile.c. Tested on jam and MacGoblin - minor changes. --- src/H5O.c | 2 +- test/tfile.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/H5O.c b/src/H5O.c index 921491c..0065b12 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1127,7 +1127,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc, /* Check for invalid access request */ if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "no write intent on file") /* Make certain we allocate at least a reasonable size for the object header */ size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint)); diff --git a/test/tfile.c b/test/tfile.c index e3b0c81..53ca035 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1318,15 +1318,15 @@ test_file_perm2(void) type = H5Tcopy(H5T_NATIVE_SHORT); CHECK(type, FAIL, "H5Tcopy"); - type = H5Tcopy(H5T_NATIVE_SHORT); - CHECK(type, FAIL, "H5Tcopy"); - /* Commit a datatype with the read-only file handle (should fail) */ H5E_BEGIN_TRY { ret = H5Tcommit2(filero, "MY_DTYPE", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Tcommit2"); + ret = H5Tclose(type); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Fclose(filero); CHECK(ret, FAIL, "H5Fclose"); -- cgit v0.12