7
pthread_t thread1, thread2;
9
void *thread1_main(void *arg)
11
capng_fill(CAPNG_SELECT_BOTH);
13
printf("thread1 filled capabilities\n");
16
if (capng_have_capabilities(CAPNG_SELECT_CAPS) < CAPNG_FULL) {
17
printf("Capabilities missing when there should be some\n");
21
printf("SUCCESS: Full capabilities reported\n");
26
void *thread2_main(void *arg)
30
printf("thread2 getting capabilities\n");
32
capng_get_caps_process();
33
if (capng_have_capabilities(CAPNG_SELECT_CAPS) != CAPNG_NONE) {
34
printf("Detected capabilities when they should not be any\n");
37
capng_clear(CAPNG_SELECT_BOTH);
39
printf("SUCCESS: No capabilities reported\n");
46
printf("Testing thread separation of capabilities\n");
47
pthread_create(&thread1, NULL, thread1_main, NULL);
48
pthread_create(&thread2, NULL, thread2_main, NULL);