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 /stdio-common | |
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 'stdio-common')
-rw-r--r-- | stdio-common/bug5.c | 4 | ||||
-rw-r--r-- | stdio-common/test-fwrite.c | 4 | ||||
-rw-r--r-- | stdio-common/tst-fseek.c | 5 |
3 files changed, 8 insertions, 5 deletions
diff --git a/stdio-common/bug5.c b/stdio-common/bug5.c index 7bfe9b2b8d..dfa19aed55 100644 --- a/stdio-common/bug5.c +++ b/stdio-common/bug5.c @@ -7,6 +7,8 @@ #include <stdlib.h> #include <unistd.h> +#include <support/support.h> + static char buf[8192]; int @@ -60,7 +62,7 @@ main (void) the perhaps incompatible new shared libraries. */ unsetenv ("LD_LIBRARY_PATH"); - asprintf (&printbuf, "cmp %s %s", inname, outname); + printbuf = xasprintf ("cmp %s %s", inname, outname); result = system (printbuf); remove (inname); remove (outname); diff --git a/stdio-common/test-fwrite.c b/stdio-common/test-fwrite.c index 5677c6da80..7f383921ca 100644 --- a/stdio-common/test-fwrite.c +++ b/stdio-common/test-fwrite.c @@ -1,6 +1,8 @@ #include <stdio.h> #include <string.h> +#include <support/support.h> + static int do_test (void) { @@ -57,7 +59,7 @@ do_test (void) return 1; } - asprintf (&line, "\ + line = xasprintf ("\ GDB is free software and you are welcome to distribute copies of it\n\ under certain conditions; type \"show copying\" to see the conditions.\n\ There is absolutely no warranty for GDB; type \"show warranty\" for details.\n\ diff --git a/stdio-common/tst-fseek.c b/stdio-common/tst-fseek.c index c4ac17cdf4..386dd1dd51 100644 --- a/stdio-common/tst-fseek.c +++ b/stdio-common/tst-fseek.c @@ -25,6 +25,7 @@ #include <time.h> #include <sys/stat.h> +#include <support/support.h> static int do_test (void) @@ -44,9 +45,7 @@ do_test (void) if (tmpdir == NULL || tmpdir[0] == '\0') tmpdir = "/tmp"; - asprintf (&fname, "%s/tst-fseek.XXXXXX", tmpdir); - if (fname == NULL) - error (EXIT_FAILURE, errno, "cannot generate name for temporary file"); + fname = xasprintf ("%s/tst-fseek.XXXXXX", tmpdir); /* Create a temporary file. */ fd = mkstemp (fname); |