From: Casper Dik Date: Fri, 15 Mar 2013 00:13:58 +0000 (+0100) Subject: Fix getpeereid() compilation on Solaris X-Git-Tag: 0.5.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4812cdf240fac5d0461288094cc94e03e030272;p=thirdparty%2Flibbsd.git 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 --- diff --git a/src/getpeereid.c b/src/getpeereid.c index 3694219..193f366 100644 --- a/src/getpeereid.c +++ b/src/getpeereid.c @@ -99,11 +99,13 @@ getpeereid(int s, uid_t *euid, gid_t *egid) } #elif defined(__sun) /* Solaris */ +#include +#include + int 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);