X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Futils%2Ftap%2Ftap.c;h=9c967f82d4e29b5b3a0aa8b7a4570131ddebd838;hp=a430951193328aca551e34dfa1f3622a9b23ef28;hb=9d16b343fb9e781fc8d8fa3c448a3f382306dd33;hpb=86a96e6cf3b4bab2fc7edd0db1b7c87c2374d27a diff --git a/tests/utils/tap/tap.c b/tests/utils/tap/tap.c index a43095119..9c967f82d 100644 --- a/tests/utils/tap/tap.c +++ b/tests/utils/tap/tap.c @@ -1,7 +1,9 @@ /*- - * Copyright (c) 2004 Nik Clayton + * Copyright (C) 2004 Nik Clayton * All rights reserved. * + * SPDX-License-Identifier: BSD-2-Clause + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -24,7 +26,6 @@ * SUCH DAMAGE. */ -#define _GNU_SOURCE #include #include #include @@ -83,7 +84,9 @@ _gen_result(int ok, const char *func, char *file, unsigned int line, expansions on it */ if(test_name != NULL) { va_start(ap, test_name); - vasprintf(&local_test_name, test_name, ap); + if (vasprintf(&local_test_name, test_name, ap) == -1) { + local_test_name = NULL; + } va_end(ap); /* Make sure the test name contains more than digits @@ -294,12 +297,14 @@ int skip(unsigned int n, char *fmt, ...) { va_list ap; - char *skip_msg; + char *skip_msg = NULL; LOCK; va_start(ap, fmt); - asprintf(&skip_msg, fmt, ap); + if (asprintf(&skip_msg, fmt, ap) == -1) { + skip_msg = NULL; + } va_end(ap); while(n-- > 0) { @@ -324,7 +329,9 @@ todo_start(char *fmt, ...) LOCK; va_start(ap, fmt); - vasprintf(&todo_msg, fmt, ap); + if (vasprintf(&todo_msg, fmt, ap) == -1) { + todo_msg = NULL; + } va_end(ap); todo = 1;