diff options
author | Aaron Bieber <aaron@bolddaemon.com> | 2020-01-18 22:13:32 -0700 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2020-01-19 14:13:32 +0900 |
commit | a1bcdc225e1c9b890214fcea3d19d85226fc552a (patch) | |
tree | 7d7a24e070e85ed0212285d1df0d56d39388ddd2 /src/protector | |
parent | 7771241cc0c91f8b53cb472671a82e57755d08c8 (diff) |
Add pledge(2) support (OpenBSD only) via a 'protector' package. (#1297)
Diffstat (limited to 'src/protector')
-rw-r--r-- | src/protector/protector.go | 8 | ||||
-rw-r--r-- | src/protector/protector_openbsd.go | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/protector/protector.go b/src/protector/protector.go new file mode 100644 index 00000000..2739c016 --- /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 00000000..84a5ded1 --- /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") +} |