about summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
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 5b74959ef8..d2f4453ad8 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 0430b7b573..8e3ad9acb6 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 81a723dda4..4c3afb8539 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 a5168a269c..5fd6c46c1f 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 1a804e94fd..e0a7c84346 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 440dfab438..f6c0cb4d98 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);