Created
July 29, 2020 08:44
-
-
Save iainlane/1277e2446e8503fc698f1a175fd4561f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <sys/capability.h> | |
| #include <sys/types.h> | |
| #include <unistd.h> | |
| int | |
| main () | |
| { | |
| pid_t pid; | |
| cap_t caps; | |
| cap_flag_value_t cap_value; | |
| pid = getpid (); | |
| caps = cap_get_pid (pid); | |
| if (!caps) | |
| { | |
| return 1; | |
| } | |
| if (cap_get_flag (caps, | |
| CAP_SYS_TTY_CONFIG, | |
| CAP_EFFECTIVE, | |
| &cap_value) == -1) | |
| { | |
| return 1; | |
| } | |
| switch (cap_value) | |
| { | |
| case CAP_CLEAR: | |
| printf ("CAP_SYS_TTY_CONFIG is unset\n"); | |
| break; | |
| case CAP_SET: | |
| printf ("CAP_SYS_TTY_CONFIG is set\n"); | |
| break; | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment