summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2021-03-09 14:50:13 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2021-03-09 14:50:13 (GMT)
commit22723e87d8de3b768f5a70e1658f17eb4ad85000 (patch)
treeeae5407f9044cfd585770195658ba08524adfdf9 /tools
parentd72405e43d44a3ac9ec27bb9d7a84e638a7aea10 (diff)
downloadhdf5-22723e87d8de3b768f5a70e1658f17eb4ad85000.zip
hdf5-22723e87d8de3b768f5a70e1658f17eb4ad85000.tar.gz
hdf5-22723e87d8de3b768f5a70e1658f17eb4ad85000.tar.bz2
Replaces basename and dirname with code that will work everywhere
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5tools.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index f68eb3b..2efca76 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -473,8 +473,7 @@ static hid_t
swmr_fapl_augment(hid_t fapl, const char *fname)
{
H5F_vfd_swmr_config_t *config = NULL; /* Configuration for VFD SWMR */
- const char *dname;
- char *tname;
+ char *dname = NULL;
/*
* Set up to open the file with VFD SWMR configured.
@@ -498,14 +497,13 @@ swmr_fapl_augment(hid_t fapl, const char *fname)
config->writer = FALSE;
config->md_pages_reserved = 128;
- if ((tname = strdup(fname)) == NULL) {
- HDfprintf(rawerrorstream, "temporary string allocation failed\n");
+ if (H5_dirname(fname, &dname) < 0) {
+ HDfprintf(rawerrorstream, "H5_dirname() failed\n");
return H5I_INVALID_HID;
}
- dname = dirname(tname);
- snprintf(config->md_file_path, sizeof(config->md_file_path),
+ HDsnprintf(config->md_file_path, sizeof(config->md_file_path),
"%s/my_md_file", dname);
- free(tname);
+ HDfree(dname);
/* Enable VFD SWMR configuration */
if(H5Pset_vfd_swmr_config(fapl, config) < 0) {