Skip to content

Instantly share code, notes, and snippets.

@rodolfobandeira
Last active June 25, 2017 14:52
Show Gist options
  • Select an option

  • Save rodolfobandeira/5be0380c8bfddd8eced14202cc8c3325 to your computer and use it in GitHub Desktop.

Select an option

Save rodolfobandeira/5be0380c8bfddd8eced14202cc8c3325 to your computer and use it in GitHub Desktop.
Testing OpenBSD pledge
#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