summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/vfd_swmr_common.c16
-rw-r--r--test/vfd_swmr_common.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/test/vfd_swmr_common.c b/test/vfd_swmr_common.c
index 7db2bba..252d6d7 100644
--- a/test/vfd_swmr_common.c
+++ b/test/vfd_swmr_common.c
@@ -34,6 +34,22 @@ static const hid_t badhid = H5I_INVALID_HID;
int verbosity = 2;
void
+esnprintf(char *buf, size_t bufsz, const char *fmt, ...)
+{
+ int rc;
+ va_list ap;
+
+ va_start(ap, fmt);
+ rc = vsnprintf(buf, bufsz, fmt, ap);
+ va_end(ap);
+
+ if (rc < 0)
+ err(EXIT_FAILURE, "%s: vsnprintf", __func__);
+ else if (rc >= bufsz)
+ errx(EXIT_FAILURE, "%s: buffer too small", __func__);
+}
+
+void
dbgf(int level, const char *fmt, ...)
{
va_list ap;
diff --git a/test/vfd_swmr_common.h b/test/vfd_swmr_common.h
index cd36cc3..c6916e6 100644
--- a/test/vfd_swmr_common.h
+++ b/test/vfd_swmr_common.h
@@ -97,6 +97,8 @@ H5TEST_DLL void await_signal(hid_t);
H5TEST_DLL hid_t vfd_swmr_create_fapl(bool, bool, bool);
H5TEST_DLL void dbgf(int, const char *, ...) H5_ATTR_FORMAT(printf, 2, 3);
+H5TEST_DLL void esnprintf(char *, size_t, const char *, ...)
+ H5_ATTR_FORMAT(printf, 3, 4);
H5TEST_DLL int fetch_env_ulong(const char *, unsigned long, unsigned long *);