aboutsummaryrefslogtreecommitdiff
path: root/posix
diff options
context:
space:
mode:
authorFrédéric Bérat <fberat@redhat.com>2023-06-02 17:28:06 +0200
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2023-06-06 08:23:53 -0400
commit8c4f69d711481a18c70cb9a6c0a5367604894320 (patch)
tree7dc913567c6c1975b94217c48131fb6b3eb1d98d /posix
parent7d421209287a07db5e926552ae5fbe9d8abb50dc (diff)
downloadglibc-8c4f69d711481a18c70cb9a6c0a5367604894320.zip
glibc-8c4f69d711481a18c70cb9a6c0a5367604894320.tar.gz
glibc-8c4f69d711481a18c70cb9a6c0a5367604894320.tar.bz2
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 'posix')
-rw-r--r--posix/tst-execl2.c8
-rw-r--r--posix/tst-execle2.c8
-rw-r--r--posix/tst-execlp2.c17
-rw-r--r--posix/tst-execv2.c8
-rw-r--r--posix/tst-execve2.c8
-rw-r--r--posix/tst-execvp2.c17
6 files changed, 16 insertions, 50 deletions
diff --git a/posix/tst-execl2.c b/posix/tst-execl2.c
index 5b74959..d2f4453 100644
--- a/posix/tst-execl2.c
+++ b/posix/tst-execl2.c
@@ -18,12 +18,8 @@ prepare (int argc, char *argv[])
{
char *buf;
int off;
- asprintf (&buf, "cp %s %n%s-copy", argv[0], &off, argv[0]);
- if (buf == NULL)
- {
- puts ("asprintf failed");
- exit (1);
- }
+
+ buf = xasprintf ("cp %s %n%s-copy", argv[0], &off, argv[0]);
if (system (buf) != 0)
{
puts ("system failed");
diff --git a/posix/tst-execle2.c b/posix/tst-execle2.c
index 0430b7b..8e3ad9a 100644
--- a/posix/tst-execle2.c
+++ b/posix/tst-execle2.c
@@ -18,12 +18,8 @@ prepare (int argc, char *argv[])
{
char *buf;
int off;
- asprintf (&buf, "cp %s %n%s-copy", argv[0], &off, argv[0]);
- if (buf == NULL)
- {
- puts ("asprintf failed");
- exit (1);
- }
+
+ buf = xasprintf ("cp %s %n%s-copy", argv[0], &off, argv[0]);
if (system (buf) != 0)
{
puts ("system failed");
diff --git a/posix/tst-execlp2.c b/posix/tst-execlp2.c
index 81a723d..4c3afb8 100644
--- a/posix/tst-execlp2.c
+++ b/posix/tst-execlp2.c
@@ -22,12 +22,8 @@ prepare (int argc, char *argv[])
{
char *buf;
int off;
- asprintf (&buf, "cp %s %n%s-copy", argv[0], &off, argv[0]);
- if (buf == NULL)
- {
- puts ("asprintf failed");
- exit (1);
- }
+
+ buf = xasprintf ("cp %s %n%s-copy", argv[0], &off, argv[0]);
if (system (buf) != 0)
{
puts ("system failed");
@@ -58,13 +54,8 @@ do_test (void)
puts ("canonicalize_file_name failed");
return 1;
}
- char *path;
- asprintf (&path, "%s:../libio:../elf", bindir);
- if (path == NULL)
- {
- puts ("asprintf failed");
- return 1;
- }
+
+ char *path = xasprintf ("%s:../libio:../elf", bindir);
setenv ("PATH", path, 1);
diff --git a/posix/tst-execv2.c b/posix/tst-execv2.c
index a5168a2..5fd6c46 100644
--- a/posix/tst-execv2.c
+++ b/posix/tst-execv2.c
@@ -18,12 +18,8 @@ prepare (int argc, char *argv[])
{
char *buf;
int off;
- asprintf (&buf, "cp %s %n%s-copy", argv[0], &off, argv[0]);
- if (buf == NULL)
- {
- puts ("asprintf failed");
- exit (1);
- }
+
+ buf = xasprintf ("cp %s %n%s-copy", argv[0], &off, argv[0]);
if (system (buf) != 0)
{
puts ("system failed");
diff --git a/posix/tst-execve2.c b/posix/tst-execve2.c
index 1a804e9..e0a7c84 100644
--- a/posix/tst-execve2.c
+++ b/posix/tst-execve2.c
@@ -18,12 +18,8 @@ prepare (int argc, char *argv[])
{
char *buf;
int off;
- asprintf (&buf, "cp %s %n%s-copy", argv[0], &off, argv[0]);
- if (buf == NULL)
- {
- puts ("asprintf failed");
- exit (1);
- }
+
+ buf = xasprintf ("cp %s %n%s-copy", argv[0], &off, argv[0]);
if (system (buf) != 0)
{
puts ("system failed");
diff --git a/posix/tst-execvp2.c b/posix/tst-execvp2.c
index 440dfab..f6c0cb4 100644
--- a/posix/tst-execvp2.c
+++ b/posix/tst-execvp2.c
@@ -25,12 +25,8 @@ prepare (int argc, char *argv[])
{
char *buf;
int off;
- asprintf (&buf, "cp %s %n%s-copy", argv[0], &off, argv[0]);
- if (buf == NULL)
- {
- puts ("asprintf failed");
- exit (1);
- }
+
+ buf = xasprintf ("cp %s %n%s-copy", argv[0], &off, argv[0]);
if (system (buf) != 0)
{
puts ("system failed");
@@ -61,13 +57,8 @@ do_test (void)
puts ("canonicalize_file_name failed");
return 1;
}
- char *path;
- asprintf (&path, "%s:../libio:../elf", bindir);
- if (path == NULL)
- {
- puts ("asprintf failed");
- return 1;
- }
+
+ char *path = xasprintf ("%s:../libio:../elf", bindir);
setenv ("PATH", path, 1);