xref: /linux/tools/build/feature/test-libcap.c (revision 976e3645923bdd2fe7893aae33fd7a21098bfb28)
1 // SPDX-License-Identifier: GPL-2.0
2 #include <sys/capability.h>
3 #include <linux/capability.h>
4 
main(void)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