mirror of
https://github.com/NixOS/nix
synced 2025-07-07 22:33:57 +02:00
Fix SO_PEERCRED usage on OpenBSD
getsockopt(2) documents `struct sockpeercred` with `SO_PEERCRED`. (`struct ucred` does exist, but is incompatible to the Linux version.)
This commit is contained in:
parent
fda598cfdd
commit
c84e20a296
1 changed files with 4 additions and 0 deletions
|
@ -901,7 +901,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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue