mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-01-09 11:17:37 +01:00
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 <guillem@hadrons.org>
This commit is contained in:
parent
d3a09e1cf4
commit
a4812cdf24
@ -99,11 +99,13 @@ getpeereid(int s, uid_t *euid, gid_t *egid)
|
|||||||
}
|
}
|
||||||
#elif defined(__sun)
|
#elif defined(__sun)
|
||||||
/* Solaris */
|
/* Solaris */
|
||||||
|
#include <alloca.h>
|
||||||
|
#include <ucred.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
getpeereid(int s, uid_t *euid, gid_t *egid)
|
getpeereid(int s, uid_t *euid, gid_t *egid)
|
||||||
{
|
{
|
||||||
ucred_t cred_inst;
|
ucred_t *cred = alloca(ucred_size());
|
||||||
ucred_t *cred = &cred_inst;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = getpeerucred(s, &cred);
|
ret = getpeerucred(s, &cred);
|
||||||
|
Loading…
Reference in New Issue
Block a user