benchtests: fix warn unused result
authorFrederic Berat <fberat@redhat.com>
Tue, 20 Jun 2023 18:19:09 +0000 (20:19 +0200)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Thu, 22 Jun 2023 04:21:19 +0000 (00:21 -0400)
Few tests needed to properly check for asprintf and system calls return
values with _FORTIFY_SOURCE enabled.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
benchtests/bench-strcoll.c
sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c

index b3cd5ce..0bd9ada 100644 (file)
@@ -254,7 +254,11 @@ main (void)
        }
 
       char *filename;
-      asprintf (&filename, INPUT_PREFIX "%s", input_files[i]);
+      if (asprintf (&filename, INPUT_PREFIX "%s", input_files[i]) < 0)
+       {
+         printf ("asprintf failed, aborting!\n");
+         return ERROR_FILENAME;
+       }
       result = bench_file (json_ctx, input_files[i], filename, locale + 1);
 
       if (result != OK)
index e5cdb2b..4631ec9 100644 (file)
@@ -24,6 +24,7 @@
 #include <sys/types.h>
 #include <sys/uio.h>
 #include <elf.h>
+#include <support/xstdlib.h>
 #include <support/xunistd.h>
 #include <support/check.h>
 #include <string.h>
@@ -44,7 +45,7 @@ tracee_func (int pid)
   char str[80];
   sprintf (str, "cat /proc/%d/maps", pid);
   puts (str);
-  system (str);
+  xsystem (str);
   fflush (stdout);
 
   TEST_VERIFY_EXIT (ptrace (PTRACE_TRACEME) == 0);