Compile for non OpenBSD systems

Previously the compilation would fail for non OpenBSD systems & the
user had to manage it themselves. Now it compiles on non OpenBSD
systems but returns nil immediately because unveil isn't supported on
those systems.
This commit is contained in:
Andinus 2020-04-15 00:24:55 +05:30
parent 0dfcf8cb81
commit a129334aef
Signed by: andinus
GPG Key ID: B67D55D482A799FD
8 changed files with 56 additions and 0 deletions

View File

@ -1,3 +1,5 @@
// +build openbsd
package lynx
import "golang.org/x/sys/unix"

9
block_other.go Normal file
View File

@ -0,0 +1,9 @@
// +build !openbsd
package lynx
// UnveilBlock is just a wrapper around unix.UnveilBlock, it does
// nothing on non OpenBSD systems.
func UnveilBlock() error {
return nil
}

View File

@ -1,3 +1,5 @@
// +build openbsd
package lynx
import (

9
commands_other.go Normal file
View File

@ -0,0 +1,9 @@
// +build !openbsd
package lynx
// UnveilCommands takes a slice of commands & unveils them one by one,
// it does nothing on non OpenBSD systems.
func UnveilCommands(_ []string) error {
return nil
}

View File

@ -1,3 +1,5 @@
// +build openbsd
package lynx
import "golang.org/x/sys/unix"

15
path_other.go Normal file
View File

@ -0,0 +1,15 @@
// +build !openbsd
package lynx
// UnveilPath takes a path, permission & unveils it, it does nothing
// on non OpenBSD systems.
func UnveilPath(_ string, _ string) error {
return nil
}
// UnveilPathStrict is just a wrapper around unix.Unveil. It does
// nothing on non OpenBSD systems.
func UnveilPathStrict(_ string, _ string) error {
return nil
}

View File

@ -1,3 +1,5 @@
// +build openbsd
// Package lynx is a simple wrapper to unveil.
package lynx

15
paths_other.go Normal file
View File

@ -0,0 +1,15 @@
// +build !openbsd
package lynx
// UnveilPaths takes a map of path, permission & unveils them one by
// one, it does nothing on non OpenBSD systems.
func UnveilPaths(_ map[string]string) error {
return nil
}
// UnveilPathsStrict takes a map of path, permission & unveils them
// one by one, it does nothing on non OpenBSD systems.
func UnveilPathsStrict(_ map[string]string) error {
return nil
}