diff options
author | Florian Weimer <fweimer@redhat.com> | 2016-09-21 15:24:01 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2016-09-21 15:24:01 +0200 |
commit | 85f7554cd97e7f03d8dc66278653045ef63a2221 (patch) | |
tree | da312fa82fef22107c11c5d55dbbaf1931918509 /test-skeleton.c | |
parent | fc3e1337be1c6935ab58bd13520f97a535cf70cc (diff) | |
download | glibc-85f7554cd97e7f03d8dc66278653045ef63a2221.tar.gz |
Add test case for O_TMPFILE handling in open, openat
Also put xasprintf into test-skeleton.c (written in such a way that
including <stdarg.h> is not needed).
Diffstat (limited to 'test-skeleton.c')
-rw-r--r-- | test-skeleton.c | 15 |
1 files changed, 15 insertions, 0 deletions
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 <sys/wait.h> #include <sys/param.h> #include <time.h> +#include <stdarg.h> /* 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 |