about summary refs log tree commit diff stats
path: root/mkgpt.c
diff options
context:
space:
mode:
authorPeter H. Froehlich <peter.hans.froehlich@gmail.com>2021-10-17 06:41:36 -0400
committerPeter H. Froehlich <peter.hans.froehlich@gmail.com>2021-10-17 06:41:36 -0400
commit9087339caef73478e0156fd996c5c55c52a48dcc (patch)
tree5cec0e4dbea0231ac7f219b87750f4dc121227ba /mkgpt.c
parent4a275b2e66edd7305992fc8ec5d69e7cd43d7f2f (diff)
downloadmkgpt-9087339caef73478e0156fd996c5c55c52a48dcc.tar.gz
OpenBSD "port" of sorts, Makefile is almost completely new
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) {