From 3082cd226e7affcf693cc9f4e0380880c029a141 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 4 Aug 2021 10:05:13 -0700 Subject: 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> --- test/vfd_swmr_dsetchks_writer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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"); -- cgit v0.12