-/* $OpenBSD: main.c,v 1.17 2011/09/28 19:27:18 millert Exp $ */
+/* $OpenBSD: main.c,v 1.18 2015/10/10 20:04:28 doug Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
#include <stdlib.h>
#include <string.h>
#include <signal.h>
+#include <unistd.h>
#include "awk.h"
#include "ytab.h"
{
const char *fs = NULL;
+ if (pledge("stdio rpath wpath cpath proc exec", NULL) == -1) {
+ fprintf(stderr, "%s: pledge: incorrect arguments\n",
+ cmdname);
+ exit(1);
+ }
+
setlocale(LC_ALL, "");
setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */
cmdname = __progname;
argc--;
argv++;
}
+
+ if (safe) {
+ if (pledge("stdio rpath", NULL) == -1) {
+ fprintf(stderr, "%s: pledge: incorrect arguments\n",
+ cmdname);
+ exit(1);
+ }
+ }
+
/* argv[1] is now the first argument */
if (npfile == 0) { /* no -f; first argument is program */
if (argc <= 1) {