diff --git a/main.go b/main.go index 3b59244d4017bc18adde74bba4fadc0e0563c959..f444f8be6cd6dddde0e6539a4fa74ee0f78fee7e 100644 --- a/main.go +++ b/main.go @@ -1,9 +1,13 @@ package main -import "github.com/junegunn/fzf/src" +import ( + "github.com/junegunn/fzf/src" + "github.com/junegunn/fzf/src/protector" +) var revision string func main() { + protector.Protect() fzf.Run(fzf.ParseOptions(), revision) } diff --git a/src/protector/protector.go b/src/protector/protector.go new file mode 100644 index 0000000000000000000000000000000000000000..2739c01639ca0f9340c164bca8678bd247e26f12 --- /dev/null +++ b/src/protector/protector.go @@ -0,0 +1,8 @@ +// +build !openbsd + +package protector + +// Protect calls OS specific protections like pledge on OpenBSD +func Protect() { + return +} diff --git a/src/protector/protector_openbsd.go b/src/protector/protector_openbsd.go new file mode 100644 index 0000000000000000000000000000000000000000..84a5ded14a82300a2c5cf5259f0e7f5362b2d173 --- /dev/null +++ b/src/protector/protector_openbsd.go @@ -0,0 +1,10 @@ +// +build openbsd + +package protector + +import "golang.org/x/sys/unix" + +// Protect calls OS specific protections like pledge on OpenBSD +func Protect() { + unix.PledgePromises("stdio rpath tty proc exec") +}