aboutsummaryrefslogtreecommitdiff
path: root/src/platform
diff options
context:
space:
mode:
authorRichard Markiewicz <rmarkiewicz@devolutions.net>2020-06-15 10:44:25 -0700
committerGarrett D'Amore <garrett@damore.org>2020-06-15 11:15:51 -0700
commit59301ab3f80991086519124d020edbe94a74615c (patch)
treeaf16a8b3dbf74457c7aee21f1ca32bb76ebaaaa1 /src/platform
parent2f288bddf5b501f029d080835f439ecd9c0eae47 (diff)
downloadnng-59301ab3f80991086519124d020edbe94a74615c.tar.gz
nng-59301ab3f80991086519124d020edbe94a74615c.tar.bz2
nng-59301ab3f80991086519124d020edbe94a74615c.zip
nng: support NNG_OPT_IPC_PEER_PID on modern macOS systems
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/posix/posix_ipcconn.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/platform/posix/posix_ipcconn.c b/src/platform/posix/posix_ipcconn.c
index e4d783f3..8dded3a3 100644
--- a/src/platform/posix/posix_ipcconn.c
+++ b/src/platform/posix/posix_ipcconn.c
@@ -318,7 +318,7 @@ ipc_peerid(ipc_conn *c, uint64_t *euid, uint64_t *egid, uint64_t *prid,
uint64_t *znid)
{
int fd = nni_posix_pfd_fd(c->pfd);
-#if defined(NNG_HAVE_GETPEEREID)
+#if defined(NNG_HAVE_GETPEEREID) && !defined(NNG_HAVE_LOCALPEERCRED)
uid_t uid;
gid_t gid;
@@ -373,7 +373,7 @@ ipc_peerid(ipc_conn *c, uint64_t *euid, uint64_t *egid, uint64_t *prid,
*egid = xu.cr_gid;
*prid = (uint64_t) -1;
*znid = (uint64_t) -1;
-#if defined(LOCAL_PEERPID) // present (undocumented) on macOS
+#if defined(NNG_HAVE_LOCALPEERPID) // documented on macOS since 10.8
{
pid_t pid;
if (getsockopt(fd, SOL_LOCAL, LOCAL_PEERPID, &pid, &len) ==
@@ -381,7 +381,7 @@ ipc_peerid(ipc_conn *c, uint64_t *euid, uint64_t *egid, uint64_t *prid,
*prid = (uint64_t) pid;
}
}
-#endif // LOCAL_PEERPID
+#endif // NNG_HAVE_LOCALPEERPID
return (0);
#else
if (fd < 0) {