klange/nyancat

OpenBSD pledge(2) support

fcambus opened this issue · 0 comments

OpenBSD 5.9 will ship with pledge(2). It's a security mechanism to restrict what programs are allowed to do. Most of the base system has been patched to use it, and work has started on pledging relevant third party programs in ports. It's defined in unistd.h which nyancat has already an include for.

For nyancat, it would look like this :

#if defined(__OpenBSD__)
    if (pledge("stdio tty", NULL) == -1) {
        err(1, "pledge");
    }
#endif

Would you be willing to merge this if I submit a PR?