about summary refs log tree commit diff stats
path: root/mkgpt.c
diff options
context:
space:
mode:
Diffstat (limited to 'mkgpt.c')
-rw-r--r--mkgpt.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/mkgpt.c b/mkgpt.c
index ae71032..885aac3 100644
--- a/mkgpt.c
+++ b/mkgpt.c
@@ -33,6 +33,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 struct partition {
 	GUID type;
@@ -95,6 +96,14 @@ static int secondary_gpt_sect;
 int
 main(int argc, char *argv[])
 {
+#if defined(__OpenBSD__)
+	if (pledge("stdio cpath rpath wpath", NULL) != 0) {
+		fprintf(stderr, "failed to pledge\n");
+		exit(EXIT_FAILURE);
+	}
+	/* TODO call unveil on each path AHEAD of using it? */
+#endif
+
 	random_guid(&disk_guid);
 
 	if (parse_opts(argc, argv) != 0) {