uid=(p1)
public
Sets the (user) user ID for this process. Not available on all platforms.
Show source
static VALUE
proc_setuid(VALUE obj, VALUE id)
{
rb_uid_t uid;
check_uid_switch();
uid = OBJ2UID(id);
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();
}
}
return id;
}