From: Roy Marples Date: Sun, 5 Jul 2026 15:05:25 +0000 (+0100) Subject: Add compat for Ilumos X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=86997131e5b596a0e73d5cee09881f8536751d38;p=thirdparty%2Fdhcpcd.git Add compat for Ilumos --- diff --git a/src/control.c b/src/control.c index 960ac4c3..8afc4f62 100644 --- a/src/control.c +++ b/src/control.c @@ -41,6 +41,10 @@ #include #include +#if defined(__sun) +#include +#endif + #include "common.h" #include "config.h" #include "control.h" @@ -55,7 +59,7 @@ (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)) #endif -#define SUN_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) +#define SUN_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) #define LISTEN_BACKLOG 5 @@ -113,6 +117,20 @@ getpeereid(int fd, uid_t *uid, gid_t *gid) *gid = creds.gid; return 0; } +#elif defined(__sun) +static int +getpeereid(int fd, uid_t *uid, gid_t *gid) +{ + ucred_t *ucred = NULL; + + if (getpeerucred(fd, &ucred) == -1) + return -1; + + *uid = ucred_geteuid(ucred); + *gid_t gid = ucred_getegid(ucred); + ucred_free(ucred); + return 0; +} #endif static int diff --git a/src/privsep-control.c b/src/privsep-control.c index 3ace3ad3..cb27de1b 100644 --- a/src/privsep-control.c +++ b/src/privsep-control.c @@ -37,7 +37,7 @@ #include "logerr.h" #include "privsep.h" -#define PS_CTL_FD(ctx) (ctx)->ps_ctl->psp_fd +#define PS_CTL_FD(ctx) (ctx)->ps_ctl->psp_fd /* We expect to have open 2 privsep STREAM, 2 STREAM and 2 file STREAM fds */