Skip to content

Commit

Permalink
Example code: Replace landlock.PathOpt with landlock.Rule
Browse files Browse the repository at this point in the history
Both names refer to the same type, but landlock.Rule is the better
name, so landlock.PathOpt is now deprecated.
  • Loading branch information
gnoack committed Jan 19, 2024
1 parent e337b01 commit af0413d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/landlock-restrict/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"github.com/landlock-lsm/go-landlock/landlock"
)

func parseFlags(args []string) (verbose bool, cfg landlock.Config, opts []landlock.PathOpt, cmd []string) {
func parseFlags(args []string) (verbose bool, cfg landlock.Config, opts []landlock.Rule, cmd []string) {
cfg = landlock.V3

takeArgs := func(makeOpt func(...string) landlock.FSRule) landlock.PathOpt {
takeArgs := func(makeOpt func(...string) landlock.FSRule) landlock.Rule {
var paths []string
needRefer := false
for len(args) > 0 && !strings.HasPrefix(args[0], "-") {
Expand Down
2 changes: 1 addition & 1 deletion examples/configurable/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func accessFSSet(names []string) (a landlock.AccessFSSet) {
return a
}

func exceptions(es []PathException) (opts []landlock.PathOpt) {
func exceptions(es []PathException) (opts []landlock.Rule) {
for _, e := range es {
permittedAccess := accessFSSet(e.PermittedAccess)
po := landlock.PathAccess(permittedAccess, e.Paths...)
Expand Down

0 comments on commit af0413d

Please sign in to comment.