re_exchange()
public
Show source
/*
* call-seq:
* Process::UID.re_exchange => fixnum
*
* Exchange real and effective user IDs and return the new effective
* user ID. Not available on all platforms.
*
* [Process.uid, Process.euid] #=> [0, 31]
* Process::UID.re_exchange #=> 0
* [Process.uid, Process.euid] #=> [31, 0]
*/
static VALUE
p_uid_exchange(obj)
VALUE obj;
{
int uid, euid;
check_uid_switch();
uid = getuid();
euid = geteuid();
if (setresuid(euid, uid, uid) < 0) rb_sys_fail(0);
SAVED_USER_ID = uid;
if (setreuid(euid,uid) < 0) rb_sys_fail(0);
SAVED_USER_ID = uid;
rb_notimplement();
return INT2FIX(uid);
}