client: Use cr_pid if available
This is only available on FreeBSD 13, so test for that version.
This commit is contained in:
parent
e99e7d71f7
commit
9b3bdcb12d
1 changed files with 4 additions and 0 deletions
|
@ -40,7 +40,11 @@ static int get_peer(int fd, pid_t *pid, uid_t *uid, gid_t *gid) {
|
|||
if (getsockopt(fd, 0, LOCAL_PEERCRED, &cred, &len) == -1) {
|
||||
return -1;
|
||||
}
|
||||
#if __FreeBSD_version >= 1300030
|
||||
pid = cred.cr_pid;
|
||||
#else
|
||||
*pid = -1;
|
||||
#endif
|
||||
*uid = cred.cr_uid;
|
||||
*gid = cred.cr_ngroups > 0 ? cred.cr_groups[0] : (gid_t)-1;
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue