more portable Gnome uid workaround
- incorporate a more portable way of calling the real getres*id() functions on Linux platforms that uses the glibc interface rather than calling the system call directly. The previous version didn't work on ia64 linux.
This commit is contained in:
@@ -110,6 +110,7 @@ Gnome: destroy main game windows correctly
|
|||||||
Gnome: Dylan Alex Simon's port of KDE-style worn window
|
Gnome: Dylan Alex Simon's port of KDE-style worn window
|
||||||
Gnome: Dylan Alex Simon's port of KDE-style hero cursor color
|
Gnome: Dylan Alex Simon's port of KDE-style hero cursor color
|
||||||
tty: support terms where turning off inverse video turns off color too
|
tty: support terms where turning off inverse video turns off color too
|
||||||
|
Gnome/Linux: more portable getres*id workaround
|
||||||
|
|
||||||
|
|
||||||
General New Features
|
General New Features
|
||||||
|
|||||||
@@ -19,40 +19,35 @@
|
|||||||
#ifdef GETRES_SUPPORT
|
#ifdef GETRES_SUPPORT
|
||||||
|
|
||||||
# if defined(LINUX)
|
# if defined(LINUX)
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
static _syscall3(int, getresuid, unsigned short *, ruid, \
|
/* requires dynamic linking with libc */
|
||||||
unsigned short *, euid, unsigned short *, suid)
|
#include <dlfcn.h>
|
||||||
static _syscall3(int, getresgid, unsigned short *, rgid, \
|
|
||||||
unsigned short *, egid, unsigned short *, sgid)
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
real_getresuid(ruid, euid, suid)
|
real_getresuid(ruid, euid, suid)
|
||||||
uid_t *ruid, *euid, *suid;
|
uid_t *ruid, *euid, *suid;
|
||||||
{
|
{
|
||||||
int retval;
|
int (*f)(uid_t *, uid_t *, uid_t *); /* getresuid signature */
|
||||||
unsigned short r, e, s;
|
|
||||||
retval = getresuid(&r, &e, &s);
|
f = dlsym(RTLD_NEXT, "getresuid");
|
||||||
if (!retval) {
|
if (!f) return -1;
|
||||||
*ruid = r;
|
|
||||||
*euid = e;
|
return f(ruid, euid, suid);
|
||||||
*suid = s;
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
real_getresgid(rgid, egid, sgid)
|
real_getresgid(rgid, egid, sgid)
|
||||||
gid_t *rgid, *egid, *sgid;
|
gid_t *rgid, *egid, *sgid;
|
||||||
{
|
{
|
||||||
int retval;
|
int (*f)(gid_t *, gid_t *, gid_t *); /* getresgid signature */
|
||||||
unsigned short r, e, s;
|
|
||||||
retval = getresgid(&r, &e, &s);
|
f = dlsym(RTLD_NEXT, "getresgid");
|
||||||
if (!retval) {
|
if (!f) return -1;
|
||||||
*rgid = r;
|
|
||||||
*egid = e;
|
return f(rgid, egid, sgid);
|
||||||
*sgid = s;
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# else
|
# else
|
||||||
|
|||||||
Reference in New Issue
Block a user