summaryrefslogtreecommitdiffstats
path: root/test/vfd_swmr_dsetchks_writer.c
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-08-04 17:05:13 (GMT)
committerGitHub <noreply@github.com>2021-08-04 17:05:13 (GMT)
commit3082cd226e7affcf693cc9f4e0380880c029a141 (patch)
tree773c26c397698a1910151278dde6cdd826bd9dcd /test/vfd_swmr_dsetchks_writer.c
parenta93e5420fa69d745dfa056eb73020cbab0baead8 (diff)
downloadhdf5-3082cd226e7affcf693cc9f4e0380880c029a141.zip
hdf5-3082cd226e7affcf693cc9f4e0380880c029a141.tar.gz
hdf5-3082cd226e7affcf693cc9f4e0380880c029a141.tar.bz2
VFD SWMR: Fixes naked basename() call on MacOS (#874)
* Fixes naked basename() call on MacOS * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'test/vfd_swmr_dsetchks_writer.c')
-rw-r--r--test/vfd_swmr_dsetchks_writer.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/vfd_swmr_dsetchks_writer.c b/test/vfd_swmr_dsetchks_writer.c
index 1d9bc4c..a02a042 100644
--- a/test/vfd_swmr_dsetchks_writer.c
+++ b/test/vfd_swmr_dsetchks_writer.c
@@ -265,10 +265,14 @@ state_init(state_t *s, int argc, char **argv)
int ch;
char tfile[PATH_MAX];
char * end;
+ char * base;
+
+ if (H5_basename(tfile, base) < 0)
+ TEST_ERROR
*s = ALL_HID_INITIALIZER;
esnprintf(tfile, sizeof(tfile), "%s", argv[0]);
- esnprintf(s->progname, sizeof(s->progname), "%s", basename(tfile));
+ esnprintf(s->progname, sizeof(s->progname), "%s", base);
while ((ch = getopt(argc, argv, "siferom:n:x:y:g:p:t:l:bqSNu:c:")) != -1) {
switch (ch) {
@@ -370,6 +374,8 @@ state_init(state_t *s, int argc, char **argv)
argc -= optind;
argv += optind;
+ HDfree(base);
+
/* Require to specify at least -s or -i or -f or -e or -r option */
if (!s->single_index && !s->implicit_index && !s->fa_index && !s->ea_index && !s->bt2_index) {
printf("Require to specify at least -s or -i or -f or -e or -r option\n");