Merge pull request #11022 from obsidiansystems/fix-openbsd-socket-peercred

Use proper struct sockpeercred for SO_PEERCRED for OpenBSD
This commit is contained in:
John Ericson 2024-07-03 11:56:39 -04:00 committed by GitHub
commit 509be0e77a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -203,7 +203,11 @@ static PeerInfo getPeerInfo(int remote)
#if defined(SO_PEERCRED)
# if defined(__OpenBSD__)
struct sockpeercred cred;
# else
ucred cred;
# endif
socklen_t credLen = sizeof(cred);
if (getsockopt(remote, SOL_SOCKET, SO_PEERCRED, &cred, &credLen) == -1)
throw SysError("getting peer credentials");