mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 23:36:16 +02:00
Merge pull request #11022 from obsidiansystems/fix-openbsd-socket-peercred
Use proper struct sockpeercred for SO_PEERCRED for OpenBSD
This commit is contained in:
commit
509be0e77a
1 changed files with 8 additions and 4 deletions
|
@ -203,7 +203,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");
|
||||||
|
@ -211,9 +215,9 @@ static PeerInfo getPeerInfo(int remote)
|
||||||
|
|
||||||
#elif defined(LOCAL_PEERCRED)
|
#elif defined(LOCAL_PEERCRED)
|
||||||
|
|
||||||
#if !defined(SOL_LOCAL)
|
# if !defined(SOL_LOCAL)
|
||||||
#define SOL_LOCAL 0
|
# define SOL_LOCAL 0
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
xucred cred;
|
xucred cred;
|
||||||
socklen_t credLen = sizeof(cred);
|
socklen_t credLen = sizeof(cred);
|
||||||
|
|
Loading…
Reference in a new issue