summary refs log tree commit diff stats
path: root/cmd/grus/main_openbsd.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/grus/main_openbsd.go')
-rw-r--r--cmd/grus/main_openbsd.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/cmd/grus/main_openbsd.go b/cmd/grus/main_openbsd.go
new file mode 100644
index 0000000..5222bbe
--- /dev/null
+++ b/cmd/grus/main_openbsd.go
@@ -0,0 +1,40 @@
+// +build openbsd
+
+package main
+
+import (
+	"log"
+	"os"
+
+	"golang.org/x/sys/unix"
+	"tildegit.org/andinus/grus/storage"
+	"tildegit.org/andinus/lynx"
+)
+
+func main() {
+	unveil()
+	grus()
+}
+
+func unveil() {
+	path := storage.GetDir()
+	err := os.MkdirAll(path, os.ModePerm)
+	if err != nil {
+		log.Fatalf("Unable to create directory: %s", path)
+	}
+
+	paths := make(map[string]string)
+
+	paths[path] = "rwc"
+
+	err = lynx.UnveilPathsStrict(paths)
+	if err != nil {
+		log.Fatal(err)
+	}
+
+	// Block further unveil calls.
+	err = unix.UnveilBlock()
+	if err != nil {
+		log.Fatal(err)
+	}
+}