selftests/capabilities: fix warn_unused_result build warnings
authorAmer Al Shanawany <amer.shanawany@gmail.com>
Sat, 4 May 2024 17:09:16 +0000 (19:09 +0200)
committerShuah Khan <skhan@linuxfoundation.org>
Wed, 8 May 2024 22:48:25 +0000 (16:48 -0600)
commitb0df30628459a0fb349e3de09cf0fd6548241044
tree7c05c5e2bcb2fcd0c20c4200b61bb3ad4075a115
parent051f2226a545a07b5d21b5c9d8626ddd483c68a5
selftests/capabilities: fix warn_unused_result build warnings

Fix the following warnings by adding return check and error handling.

test_execve.c: In function ‘do_tests’:
test_execve.c:100:17: warning: ignoring return value of
 ‘capng_get_caps_process’
 declared with attribute ‘warn_unused_result’ [-Wunused-result]
  100 |                 capng_get_caps_process();
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~
validate_cap.c: In function ‘main’:
validate_cap.c:47:9: warning: ignoring return value of
 ‘capng_get_caps_process’
declared with attribute ‘warn_unused_result’ [-Wunused-result]
   47 |         capng_get_caps_process();
      |         ^~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Amer Al Shanawany <amer.shanawany@gmail.com>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/capabilities/test_execve.c
tools/testing/selftests/capabilities/validate_cap.c