peek(1): pledge(2) and unveil(2) on OpenBSD
This commit is contained in:
parent
7a69e1d516
commit
3f41110617
@ -22,7 +22,8 @@
|
|||||||
#include <stdlib.h> /* exit(3), EXIT_FAILURE */
|
#include <stdlib.h> /* exit(3), EXIT_FAILURE */
|
||||||
#include <sysexits.h> /* EX_IOERR, EX_OK, EX_USAGE */
|
#include <sysexits.h> /* EX_IOERR, EX_OK, EX_USAGE */
|
||||||
#include <termios.h> /* tcgetattr(3), tcsetattr(3), struct termios, ECHO */
|
#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";
|
char *program_name = "peek";
|
||||||
|
|
||||||
@ -60,6 +61,11 @@ usage(char *argv0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]){
|
int main(int argc, char *argv[]){
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
pledge("stdio tty unveil", NULL);
|
||||||
|
unveil(NULL, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (argc > 0) { /* option parsing */
|
if (argc > 0) { /* option parsing */
|
||||||
char allow_nonterminals;
|
char allow_nonterminals;
|
||||||
int c;
|
int c;
|
||||||
|
Loading…
Reference in New Issue
Block a user