bpf, selftests: Fix warning in snprintf_btf where system() call unchecked

On my systems system() calls are marked with warn_unused_result
apparently. So without error checking we get this warning,

./prog_tests/snprintf_btf.c:30:9: warning: ignoring return value
   of ‘system’, declared with attribute warn_unused_result[-Wunused-result]

Also it seems like a good idea to check the return value anyways
to ensure ping exists even if its seems unlikely.

Fixes: 076a95f5af ("selftests/bpf: Add bpf_snprintf_btf helper tests")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/160141006897.25201.12095049414156293265.stgit@john-Precision-5820-Tower
This commit is contained in:
John Fastabend 2020-09-29 13:07:49 -07:00 коммит произвёл Alexei Starovoitov
Родитель 93b8713d61
Коммит c810b31ecb
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -27,7 +27,9 @@ void test_snprintf_btf(void)
goto cleanup;
/* generate receive event */
(void) system("ping -c 1 127.0.0.1 > /dev/null");
err = system("ping -c 1 127.0.0.1 > /dev/null");
if (CHECK(err, "system", "ping failed: %d\n", err))
goto cleanup;
if (bss->skip) {
printf("%s:SKIP:no __builtin_btf_type_id\n", __func__);