summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-05 03:43:28 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-05 03:43:28 +0000
commit82d85fe441210bf847ef7f5b803a787bb15429d0 (patch)
treebcd67e358775e5388f853a27021c1f5f45e90d3f /process.c
parent2cf2d7ee20d614ff9aa1689dcf093fe6ddde6d2b (diff)
* configure.in: Check sys/id.h, getuidx and getgidx for AIX.
* process.c (getresuid): Defined for AIX. (getresgid): Ditto AIX don't have getresuid/getresgid but getuidx/getgidx. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/process.c b/process.c
index 22783b7..cfa466b 100644
--- a/process.c
+++ b/process.c
@@ -84,6 +84,9 @@
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
+#ifdef HAVE_SYS_ID_H
+#include <sys/id.h>
+#endif
#ifdef __APPLE__
# include <mach/mach_time.h>
@@ -3277,6 +3280,42 @@ recv_child_error(int fd, int *errp, char *errmsg, size_t errmsg_buflen)
return size != 0;
}
+#if !defined(HAVE_GETRESUID) && defined(HAVE_GETUIDX)
+/* AIX 7.1 */
+static int
+getresuid(rb_uid_t *ruid, rb_uid_t *euid, rb_uid_t *suid)
+{
+ rb_uid_t ret;
+
+ *ruid = getuid();
+ *euid = geteuid();
+ ret = getuidx(ID_SAVED);
+ if (ret == (rb_uid_t)-1)
+ return -1;
+ *suid = ret;
+ return 0;
+}
+#define HAVE_GETRESUID
+#endif
+
+#if !defined(HAVE_GETRESGID) && defined(HAVE_GETGIDX)
+/* AIX 7.1 */
+static int
+getresgid(rb_gid_t *rgid, rb_gid_t *egid, rb_gid_t *sgid)
+{
+ rb_gid_t ret;
+
+ *rgid = getgid();
+ *egid = getegid();
+ ret = getgidx(ID_SAVED);
+ if (ret == (rb_gid_t)-1)
+ return -1;
+ *sgid = ret;
+ return 0;
+}
+#define HAVE_GETRESGID
+#endif
+
static int
has_privilege(void)
{