Method: Process::GID#switch

Defined in:
process.c

#switchObject (private)



7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
# File 'process.c', line 7886

static VALUE
p_gid_switch(VALUE obj)
{
    rb_gid_t gid, egid;

    check_gid_switch();

    gid = getgid();
    egid = getegid();

    if (gid == egid) {
        rb_syserr_fail(EPERM, 0);
    }
    p_gid_exchange(obj);
    if (rb_block_given_p()) {
        under_gid_switch = 1;
        return rb_ensure(rb_yield, Qnil, p_gid_sw_ensure, obj);
    }
    else {
        return GIDT2NUM(egid);
    }
}