From a8c4581be64a307aa4d38f0e1c5bc0b31cae9899 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <barracuda@macos-powerpc.org>
Date: Wed, 27 Nov 2024 09:53:09 +0800
Subject: [PATCH] wayland-os.c: LOCAL_PEERPID may not be defined

---
 src/wayland-os.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/wayland-os.c b/src/wayland-os.c
index ba2c814..81fdbee 100644
--- a/src/wayland-os.c
+++ b/src/wayland-os.c
@@ -137,7 +137,7 @@ wl_os_socket_peercred(int sockfd, uid_t *uid, gid_t *gid, pid_t *pid)
 	*pid = ucred.pid;
 	return 0;
 }
-#elif defined(HAVE_GETPEEREID) && defined(LOCAL_PEERPID)
+#elif defined(HAVE_GETPEEREID)
 int
 wl_os_socket_peercred(int sockfd, uid_t *uid, gid_t *gid, pid_t *pid)
 {
@@ -148,9 +148,11 @@ wl_os_socket_peercred(int sockfd, uid_t *uid, gid_t *gid, pid_t *pid)
 	}
 
 	len = sizeof(pid_t);
+#ifdef LOCAL_PEERPID
 	if (getsockopt(sockfd, SOL_LOCAL, LOCAL_PEERPID, pid, &len) != 0) {
 		return -1;
 	}
+#endif
 	return 0;
 }
 #else
