summaryrefslogtreecommitdiffstats
path: root/src/H5A.c
diff options
context:
space:
mode:
authorJordan Henderson <jhenderson@hdfgroup.org>2018-12-28 05:05:20 (GMT)
committerJordan Henderson <jhenderson@hdfgroup.org>2018-12-28 05:05:20 (GMT)
commitfe30b71086d1714261869a821f725e77026ba507 (patch)
treec94fe1d771cef6fd963e6c6fb2a33b44500478ba /src/H5A.c
parent5b57c69ed469fd6e4282fbda80161fdbf26d10e4 (diff)
parentb4fe787bb9fe4bfc4709a124df59dd987c9a09d2 (diff)
downloadhdf5-fe30b71086d1714261869a821f725e77026ba507.zip
hdf5-fe30b71086d1714261869a821f725e77026ba507.tar.gz
hdf5-fe30b71086d1714261869a821f725e77026ba507.tar.bz2
Merge pull request #1386 in HDFFV/hdf5 from ~JHENDERSON/hdf5:develop to develop
* commit 'b4fe787bb9fe4bfc4709a124df59dd987c9a09d2': Add test for H5Arename NULL/empty attribute name fix align H5Arename behavior with H5Arename_by_name
Diffstat (limited to 'src/H5A.c')
-rw-r--r--src/H5A.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 8ebd2b3..1b804d9 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -1201,10 +1201,16 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name)
H5TRACE3("e", "i*s*s", loc_id, old_name, new_name);
/* check arguments */
- if(!old_name || !new_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil")
if(H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
+ if(!old_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "old attribute name cannot be NULL")
+ if(!*old_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "old attribute name cannot be an empty string")
+ if(!new_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new attribute name cannot be NULL")
+ if(!*new_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new attribute name cannot be an empty string")
/* Avoid thrashing things if the names are the same */
if(HDstrcmp(old_name, new_name)) {