Skip to content

Commit 6ec194b

Browse files
committed
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 <cyphar@cyphar.com>
1 parent 879a755 commit 6ec194b

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
@@ -735,7 +735,7 @@ func setKeyLabel(label string) error {
735735
if label == "" && errors.Is(err, os.ErrPermission) {
736736
return nil
737737
}
738-
if errors.Is(err, unix.EACCES) && unix.Getuid() != unix.Gettid() {
738+
if errors.Is(err, unix.EACCES) && unix.Getpid() != unix.Gettid() {
739739
return ErrNotTGLeader
740740
}
741741
return err

0 commit comments

Comments
 (0)