diff options
author | Frédéric Bérat <fberat@redhat.com> | 2023-06-02 17:28:06 +0200 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2023-06-06 08:23:53 -0400 |
commit | 8c4f69d711481a18c70cb9a6c0a5367604894320 (patch) | |
tree | 7dc913567c6c1975b94217c48131fb6b3eb1d98d /argp | |
parent | 7d421209287a07db5e926552ae5fbe9d8abb50dc (diff) | |
download | glibc-8c4f69d711481a18c70cb9a6c0a5367604894320.tar.gz glibc-8c4f69d711481a18c70cb9a6c0a5367604894320.tar.xz glibc-8c4f69d711481a18c70cb9a6c0a5367604894320.zip |
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 <siddhesh@sourceware.org>
Diffstat (limited to 'argp')
-rw-r--r-- | argp/argp-test.c | 8 |
1 files changed, 5 insertions, 3 deletions
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 <string.h> #include <argp.h> +#include <support/support.h> + 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; |