summaryrefslogtreecommitdiff
path: root/src/lib/utils.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2026-02-12 14:54:23 +0100
committerSander Vrijders <sander@ouroboros.rocks>2026-02-13 09:22:29 +0100
commit86dba5441c686d037c493e5b498e27249aa6bd9d (patch)
treed0916720c68b193b8a8e5bae7dce5de55121f081 /src/lib/utils.c
parent4c73ee20024e1d1272a979574438749cfcd61426 (diff)
downloadouroboros-86dba5441c686d037c493e5b498e27249aa6bd9d.tar.gz
ouroboros-86dba5441c686d037c493e5b498e27249aa6bd9d.zip
lib: Fix SSM PUP creation on OS Xbe
OS X doesn't support chmod on shm files after creation. Since we already set the mode at creation, that call was redundant. Fixed the getpeereid() function was not accessible because of the guards. Fixed some differences between macOS and Linux with gid_t vs int usage. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib/utils.c')
-rw-r--r--src/lib/utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/utils.c b/src/lib/utils.c
index cfddec62..dffd35f3 100644
--- a/src/lib/utils.c
+++ b/src/lib/utils.c
@@ -150,8 +150,13 @@ bool is_ouroboros_member_uid(uid_t uid)
{
struct group * grp;
struct passwd * pw;
+#ifdef __APPLE__
+ unsigned int gid;
+ int * groups = NULL;
+#else
gid_t gid;
gid_t * groups = NULL;
+#endif
int ngroups;
int i;
@@ -187,7 +192,11 @@ bool is_ouroboros_member_uid(uid_t uid)
}
for (i = 0; i < ngroups; i++) {
+#ifdef __APPLE__
+ if (groups[i] == (int) gid) {
+#else
if (groups[i] == gid) {
+#endif
free(groups);
return true;
}