summaryrefslogtreecommitdiffstats
path: root/src/H5G.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5G.c')
-rw-r--r--src/H5G.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/H5G.c b/src/H5G.c
index 27f43e8..310ee5f 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -1359,6 +1359,7 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/,
unsigned null_grp; /* Flag to indicate this function was called with grp_ent set to NULL */
unsigned group_copy = 0; /* Flag to indicate that the group entry is copied */
unsigned last_comp = 0; /* Flag to indicate that a component is the last component in the name */
+ unsigned did_insert = 0; /* Flag to indicate that H5G_stab_insert was called */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_namei);
@@ -1481,6 +1482,7 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/,
}
} /* end if */
else {
+ did_insert = 1;
if (H5G_stab_insert(grp_ent, H5G_comp_g, ent, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert name");
HGOTO_DONE(SUCCEED);
@@ -1517,6 +1519,11 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/,
if (rest)
*rest = name; /*final null */
+ /* If this was an insert, make sure that the insert function was actually
+ * called (this catches no-op names like "." and "/") */
+ if( action== H5G_NAMEI_INSERT && !did_insert)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group already exists");
+
done:
/* If we started with a NULL obj_ent, free the entry information */
if(null_obj)