uid=(p1)
public
Sets the (integer) user ID for this process. Not available on all
platforms.
Show source
/*
* call-seq:
* Process.uid= integer => numeric
*
* Sets the (integer) user ID for this process. Not available on all
* platforms.
*/
static VALUE
proc_setuid(obj, id)
VALUE obj, id;
{
int uid = NUM2INT(id);
check_uid_switch();
if (setresuid(uid, -1, -1) < 0) rb_sys_fail(0);
if (setreuid(uid, -1) < 0) rb_sys_fail(0);
if (setruid(uid) < 0) rb_sys_fail(0);
{
if (geteuid() == uid) {
if (setuid(uid) < 0) rb_sys_fail(0);
}
else {
rb_notimplement();
}
}
rb_notimplement();
return INT2FIX(uid);
}