Skip to content

Commit a45b490

Browse files
committed
Show SELinux label on failure
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]>
1 parent bb1ec25 commit a45b490

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

go-selinux/selinux_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ func lSetFileLabel(fpath string, label string) error {
329329
break
330330
}
331331
if err != unix.EINTR {
332-
return &os.PathError{Op: "lsetxattr", Path: fpath, Err: err}
332+
return &os.PathError{Op: "lsetxattr", Path: fpath, Err: fmt.Errorf("label=%s: %v", label, err)}
333333
}
334334
}
335335

@@ -348,7 +348,7 @@ func setFileLabel(fpath string, label string) error {
348348
break
349349
}
350350
if err != unix.EINTR {
351-
return &os.PathError{Op: "setxattr", Path: fpath, Err: err}
351+
return &os.PathError{Op: "setxattr", Path: fpath, Err: fmt.Errorf("label=%s: %v", label, err)}
352352
}
353353
}
354354

0 commit comments

Comments
 (0)