benchtests: fix warn unused result

Few tests needed to properly check for asprintf and system calls return
values with _FORTIFY_SOURCE enabled.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
This commit is contained in:
Frederic Berat 2023-06-20 20:19:09 +02:00 committed by Siddhesh Poyarekar
parent d636339306
commit 99f9ae4ed0
2 changed files with 7 additions and 2 deletions

View File

@ -254,7 +254,11 @@ main (void)
} }
char *filename; 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); result = bench_file (json_ctx, input_files[i], filename, locale + 1);
if (result != OK) if (result != OK)

View File

@ -24,6 +24,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <elf.h> #include <elf.h>
#include <support/xstdlib.h>
#include <support/xunistd.h> #include <support/xunistd.h>
#include <support/check.h> #include <support/check.h>
#include <string.h> #include <string.h>
@ -44,7 +45,7 @@ tracee_func (int pid)
char str[80]; char str[80];
sprintf (str, "cat /proc/%d/maps", pid); sprintf (str, "cat /proc/%d/maps", pid);
puts (str); puts (str);
system (str); xsystem (str);
fflush (stdout); fflush (stdout);
TEST_VERIFY_EXIT (ptrace (PTRACE_TRACEME) == 0); TEST_VERIFY_EXIT (ptrace (PTRACE_TRACEME) == 0);