From 8c4f69d711481a18c70cb9a6c0a5367604894320 Mon Sep 17 00:00:00 2001 From: Frédéric Bérat Date: Fri, 2 Jun 2023 17:28:06 +0200 Subject: tests: fix warn unused result on asprintf calls When enabling _FORTIFY_SOURCE, some functions now lead to warnings when their result is not checked. Reviewed-by: Siddhesh Poyarekar --- argp/argp-test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'argp/argp-test.c') diff --git a/argp/argp-test.c b/argp/argp-test.c index c7e20f6235..cd69c81b1a 100644 --- a/argp/argp-test.c +++ b/argp/argp-test.c @@ -25,6 +25,8 @@ #include #include +#include + const char *argp_program_version = "argp-test 1.0"; struct argp_option sub_options[] = @@ -178,12 +180,12 @@ help_filter (int key, const char *text, void *input) if (key == ARGP_KEY_HELP_POST_DOC && text) { time_t now = time (0); - asprintf (&new_text, text, ctime (&now)); + new_text = xasprintf (text, ctime (&now)); } else if (key == 'f') /* Show the default for the --foonly option. */ - asprintf (&new_text, "%s (ZOT defaults to %x)", - text, params->foonly_default); + new_text = xasprintf ("%s (ZOT defaults to %x)", + text, params->foonly_default); else new_text = (char *)text; -- cgit 1.4.1