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:
parent
0dfcf8cb81
commit
a129334aef
2
block.go
2
block.go
|
@ -1,3 +1,5 @@
|
||||||
|
// +build openbsd
|
||||||
|
|
||||||
package lynx
|
package lynx
|
||||||
|
|
||||||
import "golang.org/x/sys/unix"
|
import "golang.org/x/sys/unix"
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
|
// +build openbsd
|
||||||
|
|
||||||
package lynx
|
package lynx
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
2
path.go
2
path.go
|
@ -1,3 +1,5 @@
|
||||||
|
// +build openbsd
|
||||||
|
|
||||||
package lynx
|
package lynx
|
||||||
|
|
||||||
import "golang.org/x/sys/unix"
|
import "golang.org/x/sys/unix"
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
2
paths.go
2
paths.go
|
@ -1,3 +1,5 @@
|
||||||
|
// +build openbsd
|
||||||
|
|
||||||
// Package lynx is a simple wrapper to unveil.
|
// Package lynx is a simple wrapper to unveil.
|
||||||
package lynx
|
package lynx
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue