Skip to content

Commit

Permalink
selftests/bpf: Fix unused-result warning in snprintf_btf.c
Browse files Browse the repository at this point in the history
Daniel reports:

+    system("ping -c 1 127.0.0.1 > /dev/null");

This generates the following new warning when compiling BPF selftests:

  [...]
  EXT-OBJ  [test_progs] cgroup_helpers.o
  EXT-OBJ  [test_progs] trace_helpers.o
  EXT-OBJ  [test_progs] network_helpers.o
  EXT-OBJ  [test_progs] testing_helpers.o
  TEST-OBJ [test_progs] snprintf_btf.test.o
/root/bpf-next/tools/testing/selftests/bpf/prog_tests/snprintf_btf.c: In function ‘test_snprintf_btf’:
/root/bpf-next/tools/testing/selftests/bpf/prog_tests/snprintf_btf.c:30:2: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
  system("ping -c 1 127.0.0.1 > /dev/null");
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  [...]

Fixes: 076a95f ("selftests/bpf: Add bpf_snprintf_btf helper tests")
Reported-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/1601379151-21449-2-git-send-email-alan.maguire@oracle.com
  • Loading branch information
Alan Maguire authored and Alexei Starovoitov committed Sep 29, 2020
1 parent 00e8c44 commit 96c4805
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/prog_tests/snprintf_btf.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void test_snprintf_btf(void)
goto cleanup;

/* generate receive event */
system("ping -c 1 127.0.0.1 > /dev/null");
(void) system("ping -c 1 127.0.0.1 > /dev/null");

if (bss->skip) {
printf("%s:SKIP:no __builtin_btf_type_id\n", __func__);
Expand Down

0 comments on commit 96c4805

Please sign in to comment.