t/stest: add log.o smaller helper
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/Makefile b/Makefile
index b361603..84f3088 100644
--- a/Makefile
+++ b/Makefile
@@ -64,7 +64,7 @@
OBJS = $(SOURCE:.c=.o)
T_OBJS = t/stest.o
-T_OBJS += mutex.o smalloc.o
+T_OBJS += mutex.o smalloc.o t/log.o
T_PROGS = t/stest
ifneq ($(findstring $(MAKEFLAGS),s),s)
diff --git a/t/log.c b/t/log.c
new file mode 100644
index 0000000..7f1de27
--- /dev/null
+++ b/t/log.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include <stdarg.h>
+
+int log_err(const char *format, ...)
+{
+ char buffer[1024];
+ va_list args;
+ size_t len;
+
+ va_start(args, format);
+ len = vsnprintf(buffer, sizeof(buffer), format, args);
+ va_end(args);
+
+ return fwrite(buffer, len, 1, stderr);
+}