peek(1): pledge(2) and unveil(2) on OpenBSD

This commit is contained in:
dtb 2024-08-27 21:16:12 -06:00
parent 7a69e1d516
commit 3f41110617
Signed by: trinity
GPG Key ID: 34C0543BBB6AF81B

View File

@ -22,7 +22,8 @@
#include <stdlib.h> /* exit(3), EXIT_FAILURE */
#include <sysexits.h> /* EX_IOERR, EX_OK, EX_USAGE */
#include <termios.h> /* tcgetattr(3), tcsetattr(3), struct termios, ECHO */
#include <unistd.h> /* getopt(3), isatty(3), STDIN_FILENO */
#include <unistd.h> /* getopt(3), isatty(3), pledge(2), unveil(2),
* STDIN_FILENO */
char *program_name = "peek";
@ -60,6 +61,11 @@ usage(char *argv0) {
}
int main(int argc, char *argv[]){
#ifdef __OpenBSD__
pledge("stdio tty unveil", NULL);
unveil(NULL, NULL);
#endif
if (argc > 0) { /* option parsing */
char allow_nonterminals;
int c;