From 85f7554cd97e7f03d8dc66278653045ef63a2221 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 21 Sep 2016 15:24:01 +0200 Subject: Add test case for O_TMPFILE handling in open, openat Also put xasprintf into test-skeleton.c (written in such a way that including is not needed). --- test-skeleton.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test-skeleton.c') diff --git a/test-skeleton.c b/test-skeleton.c index 913a335782..65a3818309 100644 --- a/test-skeleton.c +++ b/test-skeleton.c @@ -33,6 +33,7 @@ #include #include #include +#include /* The test function is normally called `do_test' and it is called with argc and argv as the arguments. We nevertheless provide the @@ -115,6 +116,20 @@ xrealloc (void *p, size_t n) return result; } +/* Call asprintf with error checking. */ +__attribute__ ((always_inline, format (printf, 1, 2))) +static __inline__ char * +xasprintf (const char *format, ...) +{ + char *result; + if (asprintf (&result, format, __builtin_va_arg_pack ()) < 0) + { + printf ("error: asprintf: %m\n"); + exit (1); + } + return result; +} + /* Write a message to standard output. Can be used in signal handlers. */ static void -- cgit 1.4.1