commit 23762aa112bdadc36faf0952eaccb5845040b090
parent 7e42b0ad6af11d06299e309dbc5b9ffd50c6bf49
Author: hhvn <dev@hhvn.uk>
Date: Sun, 6 Jun 2021 18:08:42 +0100
main.c main.h: use pledge()
Diffstat:
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/main.c b/main.c
@@ -172,6 +172,12 @@ main(int argc, char *argv[]) {
usage();
} ARGEND;
+ snprintf(promises, sizeof(promises),
+ "stdio rpath inet getpw dns proc id %s",
+ usecgi ? "exec" : "");
+ if (pledge(promises, NULL) == -1)
+ die(1, "pledge: %s\n", promises);
+
if (argc != 0)
usage();
diff --git a/main.h b/main.h
@@ -13,4 +13,8 @@ void handoff(int fd);
#define EXIT_USAGE 2
#define CQUEUE 255
+#ifndef __OpenBSD__
+#define pledge(a,b) 0
+#endif
+
#endif /* H_MAIN */