xref: /linux/tools/build/feature/test-libcap.c (revision 8c994eff8fcfe8ecb1f1dbebed25b4d7bb75be12)
1 // SPDX-License-Identifier: GPL-2.0
2 #include <sys/capability.h>
3 #include <linux/capability.h>
4 
5 int main(void)
6 {
7 	cap_flag_value_t val;
8 	cap_t caps = cap_get_proc();
9 
10 	if (!caps)
11 		return 1;
12 
13 	if (cap_get_flag(caps, CAP_SYS_ADMIN, CAP_EFFECTIVE, &val) != 0)
14 		return 1;
15 
16 	if (cap_free(caps) != 0)
17 		return 1;
18 
19 	return 0;
20 }
21