Skip to content

Commit f688732

Browse files
cypharcapnspacehook
authored andcommitted
keyring: fix typo in EACCES check
Commit 965323e ("SetKeyLabel: add thread group leader requirement") added verification that the caller of SetKeyLabel is the thread-group leader, however the check had a typo in it, which would almost always cause all errors to be treated as ErrNotTGLeader. It's a bit of a shame that os.Getuid() and os.Getpid() are untyped, as a one-character typo like this can really easily cause bugs without type checking... Signed-off-by: Aleksa Sarai <[email protected]>
1 parent 58325b7 commit f688732

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

go-selinux/selinux_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ func setKeyLabel(label string) error {
737737
if label == "" && errors.Is(err, os.ErrPermission) {
738738
return nil
739739
}
740-
if errors.Is(err, unix.EACCES) && unix.Getuid() != unix.Gettid() {
740+
if errors.Is(err, unix.EACCES) && unix.Getpid() != unix.Gettid() {
741741
return ErrNotTGLeader
742742
}
743743
return err

0 commit comments

Comments
 (0)