Skip to content

Commit

Permalink
Fix usage of SO_PEERCRED on OpenBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
brad0 committed Jan 14, 2025
1 parent c6483e5 commit 5fdc1db
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion indiserver/indiserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1503,9 +1503,14 @@ void UnixServer::accept()
if (verbose > 0)
{
#ifdef SO_PEERCRED
#ifdef __OpenBSD__
struct sockpeercred ucred;
socklen_t len = sizeof(struct sockpeercred);
#else
struct ucred ucred;

socklen_t len = sizeof(struct ucred);
#endif

if (getsockopt(cli_fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == -1)
{
log(fmt("getsockopt failed: %s\n", strerror(errno)));
Expand Down

0 comments on commit 5fdc1db

Please sign in to comment.