Skip to content

Commit

Permalink
Show SELinux label on failure
Browse files Browse the repository at this point in the history
We are seeing EINVAL errors with container engines setting SELinux
labels. It would be helpful to see what Labels the engines are trying
to set.

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Aug 1, 2024
1 parent bb1ec25 commit abee3c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions go-selinux/selinux_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func lSetFileLabel(fpath string, label string) error {
break
}
if err != unix.EINTR {
return &os.PathError{Op: "lsetxattr", Path: fpath, Err: err}
return &os.PathError{Op: "lsetxattr", Path: fpath, Err: fmt.Errorf("label=%s: %w", label, err)}
}
}

Expand All @@ -348,7 +348,7 @@ func setFileLabel(fpath string, label string) error {
break
}
if err != unix.EINTR {
return &os.PathError{Op: "setxattr", Path: fpath, Err: err}
return &os.PathError{Op: "setxattr", Path: fpath, Err: fmt.Errorf("label=%s: %w", label, err)}
}
}

Expand Down

0 comments on commit abee3c9

Please sign in to comment.