summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-05 09:57:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-05 09:57:00 +0000
commitb526738c3b27bc67a3e1017a051aab1163a34117 (patch)
tree05effc78bbcafc051bdd7a057993893ef75ea6c9 /process.c
parent8baffe6ef664e53a6acf0c3f52e900d37780fabb (diff)
* bignum.c (big_rshift), compile.c (validate_label,
iseq_build_from_ary_exception), cont.c (cont_capture), dir.c (dir_open_dir), gc.c (objspace_each_objects), io.c (pipe_open) (rb_io_advise), parse.y (parser_compile_string) (rb_parser_compile_file), proc.c (binding_free), process.c (rb_proc_exec_n, rb_seteuid_core, proc_setegid, rb_setegid_core) (p_uid_exchange, p_gid_exchange), regparse.c (strdup_with_null), signal.c (sig_dfl), vm.c (rb_iseq_eval, rb_iseq_eval_main), vm_insnhelper.c (vm_expandarray): suppress unused-but-set-variable warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/process.c b/process.c
index fb4d602d41..3109b9f94b 100644
--- a/process.c
+++ b/process.c
@@ -1130,7 +1130,7 @@ rb_proc_exec_n(int argc, VALUE *argv, const char *prog)
ret = proc_exec_v(args, prog);
}
ALLOCV_END(v);
- return -1;
+ return ret;
}
int
@@ -5110,11 +5110,15 @@ proc_seteuid_m(VALUE euid)
static rb_uid_t
rb_seteuid_core(rb_uid_t euid)
{
+#if defined(HAVE_SETRESUID) || (defined(HAVE_SETREUID) && !defined(OBSOLETE_SETREUID))
rb_uid_t uid;
+#endif
check_uid_switch();
+#if defined(HAVE_SETRESUID) || (defined(HAVE_SETREUID) && !defined(OBSOLETE_SETREUID))
uid = getuid();
+#endif
#if defined(HAVE_SETRESUID)
if (uid != euid) {
@@ -5196,11 +5200,16 @@ proc_getegid(VALUE obj)
static VALUE
proc_setegid(VALUE obj, VALUE egid)
{
+#if defined(HAVE_SETRESGID) || defined(HAVE_SETREGID) || defined(HAVE_SETEGID) || defined(HAVE_SETGID)
rb_gid_t gid;
+#endif
check_gid_switch();
+#if defined(HAVE_SETRESGID) || defined(HAVE_SETREGID) || defined(HAVE_SETEGID) || defined(HAVE_SETGID)
gid = NUM2GIDT(egid);
+#endif
+
#if defined(HAVE_SETRESGID)
if (setresgid(-1, gid, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREGID
@@ -5230,11 +5239,15 @@ proc_setegid(VALUE obj, VALUE egid)
static rb_gid_t
rb_setegid_core(rb_gid_t egid)
{
+#if defined(HAVE_SETRESGID) || (defined(HAVE_SETREGID) && !defined(OBSOLETE_SETREGID))
rb_gid_t gid;
+#endif
check_gid_switch();
+#if defined(HAVE_SETRESGID) || (defined(HAVE_SETREGID) && !defined(OBSOLETE_SETREGID))
gid = getgid();
+#endif
#if defined(HAVE_SETRESGID)
if (gid != egid) {
@@ -5321,12 +5334,17 @@ p_uid_exchangeable(void)
static VALUE
p_uid_exchange(VALUE obj)
{
- rb_uid_t uid, euid;
+ rb_uid_t uid;
+#if defined(HAVE_SETRESUID) || (defined(HAVE_SETREUID) && !defined(OBSOLETE_SETREUID))
+ rb_uid_t euid;
+#endif
check_uid_switch();
uid = getuid();
+#if defined(HAVE_SETRESUID) || (defined(HAVE_SETREUID) && !defined(OBSOLETE_SETREUID))
euid = geteuid();
+#endif
#if defined(HAVE_SETRESUID)
if (setresuid(euid, uid, uid) < 0) rb_sys_fail(0);
@@ -5378,12 +5396,17 @@ p_gid_exchangeable(void)
static VALUE
p_gid_exchange(VALUE obj)
{
- rb_gid_t gid, egid;
+ rb_gid_t gid;
+#if defined(HAVE_SETRESGID) || (defined(HAVE_SETREGID) && !defined(OBSOLETE_SETREGID))
+ rb_gid_t egid;
+#endif
check_gid_switch();
gid = getgid();
+#if defined(HAVE_SETRESGID) || (defined(HAVE_SETREGID) && !defined(OBSOLETE_SETREGID))
egid = getegid();
+#endif
#if defined(HAVE_SETRESGID)
if (setresgid(egid, gid, gid) < 0) rb_sys_fail(0);