Commit a4812cdf authored by Casper Dik's avatar Casper Dik Committed by Guillem Jover

Fix getpeereid() compilation on Solaris

The code in getpeereid() is unlikely to compile as ucred_t is an opaque
struct (ucred_t * works but ucred_t does not). Either you need to give
a pointer initialized to NULL and getpeerucred() allocates a new ucred
or you call it with an allocated ucred as in this patch.
Signed-off-by: Guillem Jover's avatarGuillem Jover <>
parent d3a09e1c
......@@ -99,11 +99,13 @@ getpeereid(int s, uid_t *euid, gid_t *egid)
#elif defined(__sun)
/* Solaris */
#include <alloca.h>
#include <ucred.h>
getpeereid(int s, uid_t *euid, gid_t *egid)
ucred_t cred_inst;
ucred_t *cred = &cred_inst;
ucred_t *cred = alloca(ucred_size());
int ret;
ret = getpeerucred(s, &cred);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment