From 66b19e6e7ed9dba21142af56c2d43ec76dd846e6 Mon Sep 17 00:00:00 2001 From: Andinus Date: Wed, 15 Apr 2020 19:55:00 +0530 Subject: Add Pledge wrappers --- pledge.go | 20 ++++++++++++++++++++ pledge_other.go | 21 +++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 pledge.go create mode 100644 pledge_other.go diff --git a/pledge.go b/pledge.go new file mode 100644 index 0000000..a49fa4f --- /dev/null +++ b/pledge.go @@ -0,0 +1,20 @@ +// +build openbsd + +package lynx + +import "golang.org/x/sys/unix" + +// Pledge is just a wrapper to unix.Pledge. +func Pledge(promises, execpromises string) error { + return unix.Pledge(promises, execpromises) +} + +// PledgePromises is just a wrapper to unix.PledgePromises. +func PledgePromises(promises string) error { + return unix.PledgePromises(promises) +} + +// PledgeExecpromises is just a wrapper to unix.PledgeExecpromises. +func PledgeExecpromises(execpromises string) error { + return unix.PledgeExecpromises(execpromises) +} diff --git a/pledge_other.go b/pledge_other.go new file mode 100644 index 0000000..cc2f076 --- /dev/null +++ b/pledge_other.go @@ -0,0 +1,21 @@ +// +build !openbsd + +package lynx + +// Pledge is just a wrapper to unix.Pledge. It returns nil on +// unsupported systems. +func Pledge(_, _ string) error { + return nil +} + +// PledgePromises is just a wrapper to unix.PledgePromises. It returns +// nil on unsupported systems. +func PledgePromises(_ string) error { + return nil +} + +// PledgeExecpromises is just a wrapper to unix.PledgeExecpromises. It +// returns nil on unsupported systems. +func PledgeExecpromises(_ string) error { + return nil +} -- cgit 1.4.1-2-gfad0