Last active
June 25, 2017 14:52
-
-
Save rodolfobandeira/5be0380c8bfddd8eced14202cc8c3325 to your computer and use it in GitHub Desktop.
Testing OpenBSD pledge
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 <unistd.h> | |
| #include <err.h> | |
| int main() { | |
| // if (-1 == pledge("stdio", NULL)) { | |
| // Test passing a different "promise" | |
| if (-1 == pledge("ioctl", NULL)) { | |
| err(1, "pledge error detected"); | |
| } | |
| printf("uuid: %d \n", getuid()); | |
| return 0; | |
| } | |
| /* | |
| $ gcc openbsd_pledge_test.c -o openbsd_pledge_test | |
| $ ./openbsd_pledge_test | |
| openbsd_pledge_test: pledge error detected: Invalid argument | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment