mirror of
https://github.com/NixOS/nix.git
synced 2024-11-25 08:12:29 +00:00
Use proper struct sockpeercred for SO_PEERCRED for OpenBSD
getsockopt(2) documents this; ucred is wrong ("cr_" member prefix, no pid).
(cherry picked from commit 10ccdb7a41
)
This commit is contained in:
parent
7b2b4d03bb
commit
d8c86ee2c4
@ -202,7 +202,11 @@ static PeerInfo getPeerInfo(int remote)
|
|||||||
|
|
||||||
#if defined(SO_PEERCRED)
|
#if defined(SO_PEERCRED)
|
||||||
|
|
||||||
|
# if defined(__OpenBSD__)
|
||||||
|
struct sockpeercred cred;
|
||||||
|
# else
|
||||||
ucred cred;
|
ucred cred;
|
||||||
|
# endif
|
||||||
socklen_t credLen = sizeof(cred);
|
socklen_t credLen = sizeof(cred);
|
||||||
if (getsockopt(remote, SOL_SOCKET, SO_PEERCRED, &cred, &credLen) == -1)
|
if (getsockopt(remote, SOL_SOCKET, SO_PEERCRED, &cred, &credLen) == -1)
|
||||||
throw SysError("getting peer credentials");
|
throw SysError("getting peer credentials");
|
||||||
|
Loading…
Reference in New Issue
Block a user