mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2025-01-09 17:53:56 +00:00
Add pledge(2) support (OpenBSD only) via a 'protector' package. (#1297)
This commit is contained in:
parent
7771241cc0
commit
a1bcdc225e
6
main.go
6
main.go
@ -1,9 +1,13 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import "github.com/junegunn/fzf/src"
|
import (
|
||||||
|
"github.com/junegunn/fzf/src"
|
||||||
|
"github.com/junegunn/fzf/src/protector"
|
||||||
|
)
|
||||||
|
|
||||||
var revision string
|
var revision string
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
protector.Protect()
|
||||||
fzf.Run(fzf.ParseOptions(), revision)
|
fzf.Run(fzf.ParseOptions(), revision)
|
||||||
}
|
}
|
||||||
|
8
src/protector/protector.go
Normal file
8
src/protector/protector.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// +build !openbsd
|
||||||
|
|
||||||
|
package protector
|
||||||
|
|
||||||
|
// Protect calls OS specific protections like pledge on OpenBSD
|
||||||
|
func Protect() {
|
||||||
|
return
|
||||||
|
}
|
10
src/protector/protector_openbsd.go
Normal file
10
src/protector/protector_openbsd.go
Normal file
@ -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")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user