Skip to content

Commit

Permalink
Wrap correct error on unix.GetsockoptUcred failure
Browse files Browse the repository at this point in the history
Wrap ucredErr which is set by unix.GetsockoptUcred, not the nil err.

Signed-off-by: Tobias Klauser <[email protected]>
  • Loading branch information
tklauser committed Jan 11, 2022
1 parent 0247db1 commit 5b394b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion unixcreds_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (fn UnixCredentialsFunc) Handshake(ctx context.Context, conn net.Conn) (net
}

if ucredErr != nil {
return nil, nil, fmt.Errorf("ttrpc.UnixCredentialsFunc: failed to retrieve socket peer credentials: %w", err)
return nil, nil, fmt.Errorf("ttrpc.UnixCredentialsFunc: failed to retrieve socket peer credentials: %w", ucredErr)
}

if err := fn(ucred); err != nil {
Expand Down

0 comments on commit 5b394b9

Please sign in to comment.