Wrap correct error on unix.GetsockoptUcred failure

Wrap ucredErr which is set by unix.GetsockoptUcred, not the nil err.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This commit is contained in:
Tobias Klauser 2022-01-11 20:03:32 +01:00
parent 0247db16a1
commit 5b394b91bd
No known key found for this signature in database
GPG Key ID: 6F5040074CCC0D04

View File

@ -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 {