diff options
author | Kenny Levinsen <kl@kl.wtf> | 2020-12-08 16:42:13 +0100 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2020-12-08 16:42:13 +0100 |
commit | 9b3bdcb12d0dea1cc5b96eefbc083114556df565 (patch) | |
tree | d74e035801eb9ec80cbf3ef77d0a16984abecd22 /seatd/client.c | |
parent | e99e7d71f75394b68b581e86af4bdbdb43ee64ea (diff) |
client: Use cr_pid if available
This is only available on FreeBSD 13, so test for that version.
Diffstat (limited to 'seatd/client.c')
-rw-r--r-- | seatd/client.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/seatd/client.c b/seatd/client.c index edea23c..162f4ba 100644 --- a/seatd/client.c +++ b/seatd/client.c @@ -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; |