From f11ca121a4e1c7508b30be76e331ab6bf7c219c4 Mon Sep 17 00:00:00 2001 From: Gleb Popov <6yearold@gmail.com> Date: Sat, 24 Apr 2021 11:39:13 +0300 Subject: [PATCH] Use SOL_LOCAL value instead of 0 in getsockopt() calls. Signed-off-by: Gleb Popov <6yearold@gmail.com> Change-Id: I5a58a73541de2a32c5a03ebef5618b1541209d8d --- net/Socket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/Socket.cpp b/net/Socket.cpp index a77507826..d63eb3974 100644 --- a/net/Socket.cpp +++ b/net/Socket.cpp @@ -768,7 +768,7 @@ int Socket::getPid() const #elif defined(__FreeBSD__) struct xucred creds; socklen_t credSize = sizeof(struct xucred); - if (getsockopt(_fd, 0, LOCAL_PEERCRED, &creds, &credSize) < 0) + if (getsockopt(_fd, SOL_LOCAL, LOCAL_PEERCRED, &creds, &credSize) < 0) { LOG_SYS("Failed to get pid via peer creds on " << _fd); return -1; @@ -820,7 +820,7 @@ std::shared_ptr LocalServerSocket::accept() #define CREDS_PID(c) c.cr_pid struct xucred creds; socklen_t credSize = sizeof(struct xucred); - if (getsockopt(rc, 0, LOCAL_PEERCRED, &creds, &credSize) < 0) + if (getsockopt(rc, SOL_LOCAL, LOCAL_PEERCRED, &creds, &credSize) < 0) { LOG_SYS("Failed to get peer creds on " << rc); ::close(rc);