commit 890f803693ae992987ef31454536ea8f3c59cc81
parent 5f17b7683244d5b5f04cb3222ee62515996af539
Author: vasyahacker <vasya@magicfreedom.com>
Date: Fri, 31 Mar 2023 17:15:01 +0400
unveil crossbuild
Diffstat:
3 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/cmd/idecd/main.go b/cmd/idecd/main.go
@@ -11,7 +11,6 @@ import (
"strings"
"path/filepath"
"errors"
- "golang.org/x/sys/unix"
)
func open_db(path string) *ii.DB {
@@ -116,14 +115,14 @@ func main() {
*style_path_opt)
}
- unix.Unveil(*tpl_path_opt, "r")
- unix.Unveil(*style_path_opt, "r")
- unix.Unveil(*echo_opt, "r")
- unix.Unveil(*users_opt, "rwc")
- unix.Unveil(filepath.Dir(*db_opt), "rwc")
- unix.Unveil(*db_opt + ".idx", "rwc")
- unix.Unveil(os.TempDir(), "rwc")
- unix.UnveilBlock()
+ unveil(*tpl_path_opt, "r")
+ unveil(*style_path_opt, "r")
+ unveil(*echo_opt, "r")
+ unveil(*users_opt, "rwc")
+ unveil(filepath.Dir(*db_opt), "rwc")
+ unveil(*db_opt + ".idx", "rwc")
+ unveil(os.TempDir(), "rwc")
+ unveil_block()
db := open_db(*db_opt)
edb := ii.LoadEcholist(*echo_opt)
diff --git a/cmd/idecd/unveil_openbsd.go b/cmd/idecd/unveil_openbsd.go
@@ -0,0 +1,14 @@
+//go:build openbsd
+// +build openbsd
+
+package main
+
+import "golang.org/x/sys/unix"
+
+func unveil(path string, permissions string) error {
+ return unix.Unveil(path, permissions)
+}
+
+func unveil_block() error {
+ return unix.UnveilBlock()
+}
+\ No newline at end of file
diff --git a/cmd/idecd/unveil_other.go b/cmd/idecd/unveil_other.go
@@ -0,0 +1,12 @@
+//go:build !openbsd
+// +build !openbsd
+
+package main
+
+func unveil(path string, permissions string) error {
+ return nil
+}
+
+func unveil_block() error {
+ return nil
+}
+\ No newline at end of file