In RHEL7.0(3.10.0) the value of CAP_LAST_CAP in linux/capability.h is 36, it is
greater than in the capability.h which is used to create
libcap.so(libcap-2.22-8) and that value is 34. Then cap_get_flag returns -1, and
errno is set to EINVAL. Add comments to make this clear.

Signed-off-by: Zeng Linggang <zenglg...@cn.fujitsu.com>
---
 testcases/kernel/security/securebits/check_keepcaps.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/testcases/kernel/security/securebits/check_keepcaps.c 
b/testcases/kernel/security/securebits/check_keepcaps.c
index 83e463e..a602fb5 100644
--- a/testcases/kernel/security/securebits/check_keepcaps.c
+++ b/testcases/kernel/security/securebits/check_keepcaps.c
@@ -38,6 +38,16 @@ static int eff_caps_empty(cap_t c)
 
        for (i = 0; i < CAP_LAST_CAP; i++) {
                ret = cap_get_flag(c, i, CAP_PERMITTED, &v);
+               /*
+                * If the value of CAP_LAST_CAP in linux/capability.h is greater
+                * than the value in the capability.h which is used to create
+                * libcap.so. Then cap_get_flag returns -1, and errno is set to
+                * EINVAL.
+                */
+               if (ret == -1) {
+                       tst_brkm(TBROK | TERRNO, NULL,
+                               "Not expected. Please check arguments.");
+               }
                if (ret || v)
                        empty = 0;
        }
-- 
1.9.3




------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to