re_exchange()
public
Show source
/*
* call-seq:
* Process::GID.re_exchange => fixnum
*
* Exchange real and effective group IDs and return the new effective
* group ID. Not available on all platforms.
*
* [Process.gid, Process.egid] #=> [0, 33]
* Process::GID.re_exchange #=> 0
* [Process.gid, Process.egid] #=> [33, 0]
*/
static VALUE
p_gid_exchange(obj)
VALUE obj;
{
int gid, egid;
check_gid_switch();
gid = getgid();
egid = getegid();
if (setresgid(egid, gid, gid) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = gid;
if (setregid(egid,gid) < 0) rb_sys_fail(0);
SAVED_GROUP_ID = gid;
rb_notimplement();
return INT2FIX(gid);
}